leetcode

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

1780.cpp (173B)


1 class Solution { 2 public: 3 bool checkPowersOfThree(int n) { 4 while (n > 0 && n % 3 != 2) 5 n = (n % 3) ? n - 1 : n / 3; 6 return n == 0; 7 } 8 };