Movatterモバイル変換


[0]ホーム

URL:


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

Commitef80af0

Browse files
committed
update: 50
1 parent744b754 commitef80af0

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This is the solutions collection of my LeetCode submissions, most of them are pr
4141
| 46|[Permutations](https://leetcode.com/problems/permutations/)|[JavaScript](./src/permutations/res.js)| Medium|
4242
| 48|[Rotate Image](https://leetcode.com/problems/rotate-image/)|[JavaScript](./src/rotate-image/res.js)| Medium|
4343
| 49|[Group Anagrams](https://leetcode.com/problems/anagrams/)|[JavaScript](./src/anagrams/res.js)| Medium|
44+
| 50|[powx-n](https://leetcode.com/problems/powx-n/)|[TypeScript](./src/powx-n/res.ts)| Medium|
4445
| 53|[Maximum Subarray](https://leetcode.com/problems/maximum-subarray/)|[JavaScript](./src/maximum-subarray/res.js) ·[TypeScript](./src/maximum-subarray/res.ts)| Easy|
4546
| 54|[Spiral Matrix](https://leetcode.com/problems/spiral-matrix/)|[JavaScript](./src/spiral-matrix/res.js)| Medium|
4647
| 55|[Jump Game](https://leetcode.com/problems/jump-game/) <sup>*</sup>|[JavaScript](./src/jump-game/res.js)| Medium|

‎src/powx-n/res.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
functionmyPow(x:number,n:number):number{
2+
if(n===0){
3+
return1;
4+
}elseif(n===1){
5+
returnx;
6+
}elseif(n>0){
7+
if(n%2===0){
8+
returnmyPow(x*x,n/2);
9+
}else{
10+
returnx*myPow(x,n-1);
11+
}
12+
}else{
13+
return1/myPow(x,-n);
14+
}
15+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp