refactor: refactor project structure
This commit is contained in:
21
legacy/326 isPowerOfThree/C#/Program.cs
Executable file
21
legacy/326 isPowerOfThree/C#/Program.cs
Executable file
@@ -0,0 +1,21 @@
|
||||
public class Solution {
|
||||
public bool IsPowerOfThree(int n) {
|
||||
if(n <= 0)
|
||||
return false;
|
||||
if(n == 1)
|
||||
return true;
|
||||
if(n % 3 != 0)
|
||||
return false;
|
||||
return IsPowerOfThree(n/3);
|
||||
}
|
||||
}
|
||||
|
||||
class program{
|
||||
static void Main(){
|
||||
var Solution = new Solution();
|
||||
|
||||
Console.WriteLine(Solution.IsPowerOfThree(9));
|
||||
Console.WriteLine(Solution.IsPowerOfThree(0));
|
||||
Console.WriteLine(Solution.IsPowerOfThree(-1));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user