Skip to content

Commit da609fa

Browse files
committed
指定版本号
1 parent f900694 commit da609fa

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ deno task lint
7272

7373
5.导入模块
7474

75+
不指定版本号
76+
7577
```ts
7678
import {} from "https://gitee.com/masx200/leetcode-test/raw/master/mod.ts";
7779
```
@@ -84,6 +86,20 @@ import {} from "https://github.com/masx200/leetcode-test/raw/master/mod.ts";
8486
import {} from "https://cdn.jsdelivr.net/gh/masx200/leetcode-test/mod.ts";
8587
```
8688

89+
指定版本号
90+
91+
```ts
92+
import {} from "https://gitee.com/masx200/leetcode-test/raw/4.0.1/mod.ts";
93+
```
94+
95+
```ts
96+
import {} from "https://github.com/masx200/leetcode-test/raw/4.0.1/mod.ts";
97+
```
98+
99+
```ts
100+
import {} from "https://cdn.jsdelivr.net/gh/masx200/leetcode-test@4.0.1/mod.ts";
101+
```
102+
87103
6.使用举例
88104

89105
```ts

powx-n/index.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,25 @@ export default function myPow(x: number, n: number): number {
2525
// return cached;
2626
// }
2727

28-
const result =
29-
n === 1
30-
? x
31-
: x < 0
32-
? (n % 2 === 0 ? 1 : -1) * myPow(-x, n)
33-
: x === 1
34-
? 1
35-
: x === 0
36-
? 0
37-
: n === 0
38-
? 1
39-
: n < 0
40-
? myPow(1 / x, -n)
41-
: n % 2
42-
? x * myPow(x, n - 1)
43-
: /* lazyMultiplyPositive(
28+
const result = n === 1
29+
? x
30+
: x < 0
31+
? (n % 2 === 0 ? 1 : -1) * myPow(-x, n)
32+
: x === 1
33+
? 1
34+
: x === 0
35+
? 0
36+
: n === 0
37+
? 1
38+
: n < 0
39+
? myPow(1 / x, -n)
40+
: n % 2
41+
? x * myPow(x, n - 1)
42+
: /* lazyMultiplyPositive(
4443
() => x,
4544
() => myPow(x, n - 1)
4645
) */
47-
myPow(x * x, Math.floor(n / 2));
46+
myPow(x * x, Math.floor(n / 2));
4847
/* lazyMultiplyPositive(
4948
() => myPow(x, Math.floor(n / 2)),
5049
() => myPow(x, n - Math.floor(n / 2)),

0 commit comments

Comments
 (0)