Skip to content

Commit ffff25c

Browse files
committed
2 parents 847cd9b + 5c48ee3 commit ffff25c

5 files changed

Lines changed: 18 additions & 21 deletions

File tree

CppProperties.json

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public:
3+
bool isPowerOfTwo(int n) {
4+
return n > 0 && (n & (n-1)) == 0;
5+
}
6+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def isPowerOfTwo(self, n: int) -> bool:
3+
return n > 0 and (n&(n-1) ) == 0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public:
3+
int addDigits(int num) {
4+
return num > 0 ? (num-1)%9 + 1 : 0;
5+
}
6+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def addDigits(self, num: int) -> int:
3+
return (num-1) % 9 + 1 if num else 0

0 commit comments

Comments
 (0)