mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
Add LeetCode 231
This commit is contained in:
parent
2e692eddeb
commit
8f0602c9f1
@ -52,6 +52,7 @@ LeetCode
|
||||
|215|[Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) | [C](./src/215.c)|Medium|
|
||||
|217|[Contains Duplicate](https://leetcode.com/problems/contains-duplicate/) | [C](./src/217.c)|Easy|
|
||||
|226|[Invert Binary Tree](https://leetcode.com/problems/invert-binary-tree/) | [C](./src/226.c)|Easy|
|
||||
|231|[Power of Two](https://leetcode.com/problems/power-of-two/) | [C](./src/231.c)|Easy|
|
||||
|234|[Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/) | [C](./src/234.c)|Easy|
|
||||
|268|[Missing Number](https://leetcode.com/problems/missing-number/) | [C](./src/268.c)|Easy|
|
||||
|278|[First Bad Version](https://leetcode.com/problems/first-bad-version/) | [C](./src/278.c)|Easy|
|
||||
|
5
leetcode/src/231.c
Normal file
5
leetcode/src/231.c
Normal file
@ -0,0 +1,5 @@
|
||||
bool isPowerOfTwo(int n){
|
||||
if (! n) return false;
|
||||
while (n % 2 == 0) n /= 2;
|
||||
return n == 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user