Skip to content

Commit c354ddd

Browse files
authored
Update README_EN.md for solution to lc problem: No.1630
1 parent 91997a7 commit c354ddd

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

solution/0900-0999/0935.Knight Dialer/README_EN.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,35 @@ func knightDialer(n int) int {
176176
}
177177
```
178178

179+
### **C#**
180+
181+
```cs
182+
public class Solution {
183+
public int KnightDialer(int n) {
184+
if (n == 1) return 10;
185+
int A = 4;
186+
int B = 2;
187+
int C = 2;
188+
int D = 1;
189+
int MOD = (int)1e9 + 7;
190+
for (int i = 0; i < n - 1; i++) {
191+
int tempA = A;
192+
int tempB = B;
193+
int tempC = C;
194+
int tempD = D;
195+
A = ((2 * tempB) % MOD + (2 * tempC) % MOD) % MOD;
196+
B = tempA;
197+
C = (tempA + (2 * tempD) % MOD) % MOD;
198+
D = tempC;
199+
}
200+
201+
int ans = (A + B) % MOD;
202+
ans = (ans + C) % MOD;
203+
return (ans + D) % MOD;
204+
}
205+
}
206+
```
207+
179208
### **...**
180209

181210
```

0 commit comments

Comments
 (0)