My accepted DP solution
\nint[][] moves = {{1, 2}, {1, -2}, {2, 1}, {2, -1}, {-1, 2}, {-1, -2}, {-2, 1}, {-2, -1}};\npublic double knightProbability(int N, int K, int r, int c) {\n    
```\nint[][] moves = {{1, 2}, {1, -2}, {2, 1}, {2, -1}, {-1, 2}, {-1, -2}, {-2, 1}, {-2, -1}};\npublic double knightProbability(int N, int K, int r, int c) {\n    int len = N;\n    double dp0[][] = new double[len][len];\n    for(double[] row : dp0) Arrays.fill(row, 1);\n    for(int l = 0; l < K; l++) {\n        double[][] dp1 = new double[len][len];\n        for(int i = 0; i < len; i++) {\n            for(int j = 0; j < len; j++) {\n                for(int[] move : moves) {\n                    int row = i + move[0];\n                    int col = j + move[1];\n                    if(isLegal(row, col, len)) dp1[i][j] += dp0[row][col];\n                }\n            }\n        }\n        dp0 = dp1;\n    }\n    return dp0[r][c] / Math.pow(8, K); \n}\nprivate boolean isLegal(int r, int c, int len) {\n    return r >= 0 && r < len && c >= 0 && c < len;\n}\n```
[]