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)


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