Mirror Reflection LeetCode solution in C++

1
class Solution {
2
public:
3
int mirrorReflection(int p, int q) {
4
while (p % 2 == 0 && q % 2 == 0) {
5
p /= 2;
6
q /= 2;
7
}
8
return 1 - p % 2 + q % 2;
9
}
10
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0