leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
0263.cpp (207B)
0 class Solution { 1 public: 2 bool isUgly(int n) { 3 if (n <= 0) return false; 4 for (auto i : {2, 3, 5}) 5 while (n % i == 0) 6 n /= i; 7 8 return n == 1; 9 } 10 };