simple c++ dp
\nclass Solution {\npublic:\n    double knightProbability(int N, int K, int r, int c) {\n        vector<vector<double>> curr(N,vector<double>(N,0.0));\n        
```\nclass Solution {\npublic:\n    double knightProbability(int N, int K, int r, int c) {\n        vector<vector<double>> curr(N,vector<double>(N,0.0));\n        curr[r][c] = 1.0;\n        int dirx[] = {-2,-1,1,2,2,1,-1,-2};\n        int diry[] = {1,2,2,1,-1,-2,-2,-1};\n        for(int k=0;k<K;k++)\n        {\n            vector<vector<double>> next(N,vector<double>(N,0.0));\n            for(int i = 0;i<N;i++)\n            {\n                for(int j = 0;j<N;j++)\n                {\n                    if(curr[i][j]!=0)\n                    {\n                        for(int a = 0;a<8;a++)\n                        {\n                            int cr = i+dirx[a];\n                            int cc = j+diry[a];\n                            if ( cr>=0 && cr < N &&  cc>=0 && cc < N) \n                                next[cr][cc]+=curr[i][j] / 8.0;\n                        }\n                    }\n                }\n            }\n            curr=next;\n        }\n        double ans = 0.0;\n        for(int i = 0;i<N;i++)\n        {\n            for(int j = 0;j<N;j++)\n            {\n                ans+=curr[i][j];\n            }\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C']