Dsa
Bit Manipulation
Medium
Check if Power of Three
Write a function that checks if a given positive integer n is a power of three or not without using any loops or recursion.
For example:
Input:
27
Output:
True
Explanation:
27 is 3^3, which is a power of three.
Key concepts
bit manipulationmathematical properties
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now