Skip to content

Commit 1ee0120

Browse files
authored
feat: update ts solution to lc problem: No.1654 (doocs#1545)
1 parent f1585d4 commit 1ee0120

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

solution/1600-1699/1654.Minimum Jumps to Reach Home/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,7 @@ function minimumJumps(
241241
const s: Set<number> = new Set(forbidden);
242242
const q: [number, number][] = [[0, 1]];
243243
const n = 6000;
244-
const vis: boolean[][] = Array(n)
245-
.fill(0)
246-
.map(() => Array(2).fill(false));
244+
const vis: boolean[][] = Array.from({ length: n }, () => [false, false]);
247245
vis[0][1] = true;
248246
for (let ans = 0; q.length; ++ans) {
249247
for (let t = q.length; t; --t) {

solution/1600-1699/1654.Minimum Jumps to Reach Home/README_EN.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ function minimumJumps(
212212
const s: Set<number> = new Set(forbidden);
213213
const q: [number, number][] = [[0, 1]];
214214
const n = 6000;
215-
const vis: boolean[][] = Array(n)
216-
.fill(0)
217-
.map(() => Array(2).fill(false));
215+
const vis: boolean[][] = Array.from({ length: n }, () => [false, false]);
218216
vis[0][1] = true;
219217
for (let ans = 0; q.length; ++ans) {
220218
for (let t = q.length; t; --t) {

solution/1600-1699/1654.Minimum Jumps to Reach Home/Solution.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ function minimumJumps(
77
const s: Set<number> = new Set(forbidden);
88
const q: [number, number][] = [[0, 1]];
99
const n = 6000;
10-
const vis: boolean[][] = Array(n)
11-
.fill(0)
12-
.map(() => Array(2).fill(false));
10+
const vis: boolean[][] = Array.from({ length: n }, () => [false, false]);
1311
vis[0][1] = true;
1412
for (let ans = 0; q.length; ++ans) {
1513
for (let t = q.length; t; --t) {

0 commit comments

Comments
 (0)