
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Power of Three
								Certification: Basic Level
								Accuracy: 0%
								Submissions: 0
								Points: 5
							
							Write a C program to check if a given integer is a power of three. An integer n is a power of three if there exists an integer i such that n = 3^i.
Example 1
- Input: n = 27
 - Output: true
 - Explanation: 
    
- We need to determine if 27 can be expressed as 3^i for some integer i.
 - 27 = 3^3 (3 * 3 * 3 = 27)
 - Since 27 can be expressed as 3^3, it is a power of three.
 
 
Example 2
- Input: n = 0
 - Output: false
 - Explanation: 
    
- 0 cannot be expressed as 3^i for any integer i.
 - 3^i is always positive for any integer i.
 - Therefore, 0 is not a power of three.
 
 
Constraints
- -2^31 <= n <= 2^31 - 1
 - You must solve this without using loops or recursion
 - Time Complexity: O(1)
 - Space Complexity: O(1)
 
Editorial
									
												
My Submissions
										All Solutions
									| Lang | Status | Date | Code | 
|---|---|---|---|
| You do not have any submissions for this problem. | |||
| User | Lang | Status | Date | Code | 
|---|---|---|---|---|
| No submissions found. | ||||
Solution Hints
- Consider the properties of powers of three
 - In base-10, powers of three have specific patterns
 - Use mathematical properties to check if a number is a power of three
 - Consider that the largest power of three within the 32-bit signed integer range is 3^19 = 1162261467
 - Remember that only positive integers can be powers of three