leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
0672.cpp (293B)
0 class Solution { 1 public: 2 int flipLights(const int n, const int presses) const { 3 if (n == 0 || presses == 0) return 1; 4 if (n == 1) return 2; 5 if (n == 2) return presses == 1 ? 3 : 4; 6 if (presses == 1) return 4; 7 return presses == 2 ? 7 : 8; 8 } 9 };