Day i do not know
This commit is contained in:
10
231. Power of Two/Solution.cs
Normal file
10
231. Power of Two/Solution.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace _231._Power_of_Two;
|
||||
|
||||
public class Solution
|
||||
{
|
||||
public bool IsPowerOfTwo(int n)
|
||||
{
|
||||
double log = Math.Log(n, 2);
|
||||
return Math.Round(log, 12) == (int)log;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user