diff --git a/1780. Check if Number is a Sum of Powers of Three b/1780. Check if Number is a Sum of Powers of Three new file mode 100644 index 0000000..ac740cb --- /dev/null +++ b/1780. Check if Number is a Sum of Powers of Three @@ -0,0 +1,13 @@ +class Solution { +public: + bool checkPowersOfThree(int n) { + while(n > 0){ + int remainder = n % 3; + if(remainder == 2){ + return false; + } + n = n / 3; + } + return true; + } +};