Tap here to switch tabs
Problem
Submissions

Problem: Check if Number is a Sum of Powers of Three

med
30 min
Try to solve the Check if Number is a Sum of Powers of Three problem.

Statement

Given an integer n, return true if n can be represented as the sum of distinct powers of 33. Otherwise, return false.

An integer y is a power of 33 if there exists an integer x such that y =3x= 3^x where x ≥0\geq 0.

Constraints:

  • 1≤1 \leq n ≤107\leq 10^7

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check if Number is a Sum of Powers of Three

med
30 min
Try to solve the Check if Number is a Sum of Powers of Three problem.

Statement

Given an integer n, return true if n can be represented as the sum of distinct powers of 33. Otherwise, return false.

An integer y is a power of 33 if there exists an integer x such that y =3x= 3^x where x ≥0\geq 0.

Constraints:

  • 1≤1 \leq n ≤107\leq 10^7