Java - Recursion + Memoization
\nclass Solution {\n    private Double dp[][][];\n\n    public double knightProbability(int n, int k, int row, int column) {\n        dp = new Double[n][n][k + 
```\nclass Solution {\n    private Double dp[][][];\n\n    public double knightProbability(int n, int k, int row, int column) {\n        dp = new Double[n][n][k + 1];\n        return getProbability(n, row, column, k);\n    }\n\n    private double getProbability(int n, int row, int col, int k) {\n        if (row < 0 || col < 0 || row >= n || col >= n) {\n            return 0;\n        }\n\n        if (dp[row][col][k] != null) {\n            return dp[row][col][k];\n        }\n\n        if (k == 0) {\n            return 1;\n        }\n\n        double total = (\n            getProbability(n, row - 2, col + 1, k - 1) + \n            getProbability(n, row - 2, col - 1, k - 1) + \n            getProbability(n, row + 2, col + 1, k - 1) + \n            getProbability(n, row + 2, col - 1, k - 1) + \n            getProbability(n, row - 1, col + 2, k - 1) +\n            getProbability(n, row - 1, col - 2, k - 1) + \n            getProbability(n, row + 1, col + 2, k - 1) +\n            getProbability(n, row + 1, col - 2, k - 1)\n        );\n\n        return dp[row][col][k] = total / 8.0;\n    }\n}\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'Java']