[C++] 3D DP
Approach\ndp[x][y][k] where x is the row, y is the column and k is the number of steps left.\n\n# Complexity\n- Time complexity:\nO(nnk)\n\n- Space complexity:\
# Approach\n`dp[x][y][k]` where `x` is the row, `y` is the column and `k` is the number of steps left.\n\n# Complexity\n- Time complexity:\n$$O(n*n*k)$$\n\n- Space complexity:\n$$O(n*n*k)$$\n\n# Code\n```\nclass Solution {\n    vector<vector<int>> dirs = {{-2,-1},{-1,-2},{1,-2},{2,-1},{2,1},{1,2},{-2,1},{-1,2}};\n    int kay;\npublic:\n    double helper(int x, int y, int n, int k, vector<vector<vector<double>>>& dp){\n        if(k==0)return (double)pow(0.125,kay);\n        if(dp[x][y][k]!=-1)return dp[x][y][k];\n        double ans = 0;\n        for(auto&i:dirs){\n            if(x+i[0]>=0&&x+i[0]<n&&y+i[1]>=0&&y+i[1]<n){\n                ans+=helper(x+i[0],y+i[1],n, k-1,dp);\n            }\n        }\n        return dp[x][y][k]=ans;\n    }\n    double knightProbability(int n, int k, int row, int column) {\n        kay=k;\n        vector<vector<vector<double>>> dp(n,vector<vector<double>>(n,vector<double>(k+1,-1)));\n        return (helper(row,column,n,k,dp));\n    }\n};\n```\n\n```\n\n  int   int   if if if  set       set   OOO    for for for EEEEE  \n  int   int   if    if   set     set  O     O      for     E      \n  int   int   if if if    set   set   O     O      for     EEE    \n  int   int   if           set set    O     O      for     E      \n   int int    if             set        OOO        for     EEEEE  \n```
['Dynamic Programming', 'C++']