Skip to content

Commit e0ce75b

Browse files
refactor 688
1 parent 0c37eab commit e0ce75b

File tree

1 file changed

+0
-25
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-25
lines changed

src/main/java/com/fishercoder/solutions/_688.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,6 @@
44
import java.util.LinkedList;
55
import java.util.Queue;
66

7-
/**
8-
* 688. Knight Probability in Chessboard
9-
*
10-
* On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves.
11-
* The rows and columns are 0 indexed, so the top-left square is (0, 0), and the bottom-right square is (N-1, N-1).
12-
* A chess knight has 8 possible moves it can make, as illustrated below.
13-
* Each move is two squares in a cardinal direction, then one square in an orthogonal direction.
14-
* Each time the knight is to move, it chooses one of eight possible moves uniformly at random
15-
* (even if the piece would go off the chessboard) and moves there.
16-
* The knight continues moving until it has made exactly K moves or has moved off the chessboard.
17-
* Return the probability that the knight remains on the board after it has stopped moving.
18-
19-
Example:
20-
21-
Input: 3, 2, 0, 0
22-
Output: 0.0625
23-
Explanation: There are two moves (to (1,2), (2,1)) that will keep the knight on the board.
24-
From each of those positions, there are also two moves that will keep the knight on the board.
25-
The total probability the knight stays on the board is 0.0625.
26-
27-
Note:
28-
N will be between 1 and 25.
29-
K will be between 0 and 100.
30-
The knight always initially starts on the board.
31-
*/
327
public class _688 {
338

349
public static class Solution1 {

0 commit comments

Comments
 (0)