check-if-number-is-a-sum-of-powers-of-three 1.0.0
Check if Number is a Sum of Powers of Three
Loading...
Searching...
No Matches
Solution Class Reference

Public Member Functions

bool checkPowersOfThree (int n)
 

Detailed Description

Definition at line 5 of file main.cpp.

Member Function Documentation

◆ checkPowersOfThree()

bool Solution::checkPowersOfThree ( int  n)
inline

Definition at line 8 of file main.cpp.

9 {
10 while (n > 0)
11 {
12 int remainder = n % 3;
13 if (remainder == 2)
14 return false;
15 n /= 3;
16 }
17 return true;
18 }

Referenced by main().


The documentation for this class was generated from the following file: