/*
| m = 1 | m = 2 | m = 3 |
|-------+-------------------------------+-------|
| a | a = b + c | |
| b | b = a + c | |
| c | c = a + b | |
| d | d + a | |
| | d + b | |
| | d + c | |
| | a + a = b + b = c + c = d + d | ... |
| | | d |
*/
class Solution {
public int flipLights(int n, int m) {
if (m == 0) return 1;
if (n == 1) return 2;
if (n == 2) {
if (m == 1) {
return 3;
} else {
return 4;
}
}
if (n >= 3) {
if (m == 1) return 4;
else if (m == 2) return 7;
else {
return 8;
}
}
return 0;
}
}