Power of Three Problem

Power of Three Problem — ExecCode School DSA Practice

Solve the Power of Three problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given an integer N, determine if it is a power of three. Your task is to solve Power of Three. Print true if it is, and false otherwise.

Examples

Input 27; Output True. Input 0; Output False

Constraints

-2^31 <= N <= 2^31 - 1

Practice Power of Three free on ExecCode. Browse DSA problems, topic map, and placement guides.