Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d89df03

Browse files
feat: add typescript solution to lc problem: No.0326.Power of Three
1 parent 56361b7 commit d89df03

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

‎solution/0300-0399/0326.Power of Three/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@
7979

8080
```
8181

82+
### **TypeScript**
83+
84+
```ts
85+
function isPowerOfThree(n: number): boolean {
86+
while (n > 2) {
87+
if (n % 3) return false;
88+
n /= 3;
89+
}
90+
return n == 1;
91+
};
92+
```
93+
8294
### **...**
8395

8496
```

‎solution/0300-0399/0326.Power of Three/README_EN.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@
4848

4949
```
5050

51+
### **TypeScript**
52+
53+
```ts
54+
function isPowerOfThree(n: number): boolean {
55+
while (n > 2) {
56+
if (n % 3) return false;
57+
n /= 3;
58+
}
59+
return n == 1;
60+
};
61+
```
62+
5163
### **...**
5264

5365
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function isPowerOfThree(n: number): boolean {
2+
while (n > 2) {
3+
if (n % 3) return false;
4+
n /= 3;
5+
}
6+
return n == 1;
7+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /