c++ || simple bfs solution
class Solution {\npublic:\n \n    double knightProbability(int n, int k, int row, int column) {\n        \n        vector dx = {-2,-1,1,2,2,1,-1,-2};\n        v
class Solution {\npublic:\n \n    double knightProbability(int n, int k, int row, int column) {\n        \n        vector<int> dx = {-2,-1,1,2,2,1,-1,-2};\n        vector<int> dy = {1,2,2,1,-1,-2,-2,-1};\n        \n        vector<vector<double>> curr(n,vector<double>(n,0.0));\n        \n        curr[row][column] = 1.0;\n        \n        for(int m =0;m<k;m++){\n            vector<vector<double>> next(n,vector<double>(n,0.0));\n            \n            for(int i = 0;i<n;i++){\n                for(int j = 0;j<n;j++){\n                    if(curr[i][j] != 0.0){\n                        \n                        for(int z = 0;z<8;z++){\n                            int newx = i+dx[z];\n                            int newy = j+dy[z];\n                            \n                            if(newx >= 0 && newx <n && newy >= 0 && newy <n){\n                                next[newx][newy] += curr[i][j]/8.0;\n                            }\n                        }\n                        \n                    }\n                }\n            }\n            curr = next;       \n        }\n        \n        double ans = 0.0;\n        for(int i = 0;i<n;i++){\n            for(int j = 0;j<n;j++){\n                ans += curr[i][j];\n            }\n        }       \n        return ans;\n    }\n};
['Breadth-First Search', 'C']