Skip to content

Commit 9d34990

Browse files
authored
feat: add typescript solution to lc problem: No.0342.Power of Four (doocs#429)
1 parent 25cd24c commit 9d34990

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

solution/0300-0399/0342.Power of Four/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ func isPowerOfFour(n int) bool {
109109
}
110110
```
111111

112+
### **TypeScript**
113+
114+
```ts
115+
function isPowerOfFour(n: number): boolean {
116+
return n > 0 && (n & (n - 1)) == 0 && (n & 0xaaaaaaaa) == 0;
117+
};
118+
```
119+
112120
### **...**
113121

114122
```

solution/0300-0399/0342.Power of Four/README_EN.md

+8
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ func isPowerOfFour(n int) bool {
8282
}
8383
```
8484

85+
### **TypeScript**
86+
87+
```ts
88+
function isPowerOfFour(n: number): boolean {
89+
return n > 0 && (n & (n - 1)) == 0 && (n & 0xaaaaaaaa) == 0;
90+
};
91+
```
92+
8593
### **...**
8694

8795
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function isPowerOfFour(n: number): boolean {
2+
return n > 0 && (n & (n - 1)) == 0 && (n & 0xaaaaaaaa) == 0;
3+
};

0 commit comments

Comments
 (0)