Easy 3 D approach to solve this problem
\n\n# Code\n\nclass Solution {\n    public double knightProbability(int n, int k, int row, int column) {\n        if (k == 0 || n == 0) {\n            return 1.
\n\n# Code\n```\nclass Solution {\n    public double knightProbability(int n, int k, int row, int column) {\n        if (k == 0 || n == 0) {\n            return 1.0;\n        }\n        double[][][] dp = new double[n][n][k + 1];\n        for (int i = 0; i < dp.length; i++) {\n            for (int j = 0; j < dp[0].length; j++) {\n                for (int l = 0; l <= k; l++) {\n                    dp[i][j][l] = -1.0;\n                }\n            }\n        }\n        return probabilityCalculator(n, k, row, column, 0, dp);\n    }\n\n    public double probabilityCalculator(int n, int k, int row, int column, int currentMove, double[][][] dp) {\n        if (currentMove == k) {\n            return 1.0;\n        }\n        if (dp[row][column][currentMove] != -1) {\n            return dp[row][column][currentMove];\n        }\n        int[] xMove = {-2, -2, -1, -1, 1, 1, 2, 2};\n        int[] yMove = {1, -1, 2, -2, 2, -2, 1, -1};\n        double probability = 0;\n        for (int i = 0; i < 8; i++) {\n            int newRow = row + xMove[i];\n            int newColumn = column + yMove[i];\n            if (newRow >= 0 && newColumn >= 0 && newRow < n && newColumn < n) {\n                probability += 0.125 * probabilityCalculator(n, k, newRow, newColumn, currentMove + 1, dp);\n            }\n        }\n        dp[row][column][currentMove] = probability;\n        return probability;\n    }\n}\n\n```
['Java']