1780. Check if Number is a Sum of Powers of Three Updated: 2024-03-12 1 min read Algorithms , LeetCode On This PageLeetCode problem 1780class Solution: def checkPowersOfThree(self, n: int) -> bool: while n: if n % 3 > 1: return False n //= 3 return True