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 cs solution to lc problem: No. 935 #2023

Merged
merged 4 commits into from
Nov 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update README_EN.md for solution to lc problem: No.1630
  • Loading branch information
dev-mauli authored Nov 27, 2023
commit c354ddd4af01d212b3b82ddc9f765034ae765acf
29 changes: 29 additions & 0 deletions solution/0900-0999/0935.Knight Dialer/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,35 @@ func knightDialer(n int) int {
}
```

### **C#**

```cs
public class Solution {
public int KnightDialer(int n) {
if (n == 1) return 10;
int A = 4;
int B = 2;
int C = 2;
int D = 1;
int MOD = (int)1e9 + 7;
for (int i = 0; i < n - 1; i++) {
int tempA = A;
int tempB = B;
int tempC = C;
int tempD = D;
A = ((2 * tempB) % MOD + (2 * tempC) % MOD) % MOD;
B = tempA;
C = (tempA + (2 * tempD) % MOD) % MOD;
D = tempC;
}

int ans = (A + B) % MOD;
ans = (ans + C) % MOD;
return (ans + D) % MOD;
}
}
```

### **...**

```
Expand Down