Back to the 100
Problem 007Math
Easy

Power of Three

007

Return true if n is a positive power of three.

EXAMPLES

Example 1
Input
{
  "n": 27
}

Output
true

FUNCTION SHAPE

n: intbool
00:00
5 local tests readyRun with ⌘/Ctrl + Enter. Your code stays in this browser.

Runs solve(...) locally in a browser worker. SWE Playbook does not submit your code. Only run code you trust; Python code may access the network.