leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0858.cpp (199B)


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