Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ts solution to lc problem: No.935 #2025

Merged
merged 9 commits into from
Nov 27, 2023
Prev Previous commit
Next Next commit
Update solution.ts
  • Loading branch information
iam-abhishek-yadav authored Nov 27, 2023
commit 30eb1ed5767653337cb4a2710376e0ccd37b86c0
8 changes: 4 additions & 4 deletions solution/0900-0999/0935.Knight Dialer/solution.ts
Original file line number Diff line number Diff line change
@@ -5,10 +5,10 @@ function knightDialer(n: number): number {
return 10;
}

let f: number[] = new Array(10).fill(1);
const f: number[] = new Array(10).fill(1);

while (--n > 0) {
let t: number[] = new Array(10).fill(0);
const t: number[] = new Array(10).fill(0);

t[0] = f[4] + f[6];
t[1] = f[6] + f[8];
@@ -26,9 +26,9 @@ function knightDialer(n: number): number {
}

let ans: number = 0;
for (let v of f) {
for (const v of f) {
ans = (ans + v) % MOD;
}

return ans;
}
}