Image Explanation🏆- [Probability + DP] - Super Easy to Understand
Video Solution (Aryan Mittal) - Link in LeetCode Profile\nKnight Probability in Chessboard by Aryan Mittal\n\n\n\n# Approach & Intution\n\n\n\n\n\n\n\n\n# Code\
# Video Solution (`Aryan Mittal`) - Link in LeetCode Profile\n`Knight Probability in Chessboard` by `Aryan Mittal`\n![lc.png](https://assets.leetcode.com/users/images/acce3365-b682-4427-9a7d-48dd8a552a82_1690004822.287437.png)\n\n\n# Approach & Intution\n![image.png](https://assets.leetcode.com/users/images/8dd19903-ef79-4485-a560-ad90b37b6142_1689999085.8943114.png)\n![image.png](https://assets.leetcode.com/users/images/f41143d0-407f-48ef-b9df-6ceed7766fa0_1689999099.2577646.png)\n![image.png](https://assets.leetcode.com/users/images/c9071a3a-1828-4ccc-bbd0-6eb225e4ad4e_1689999107.0034423.png)\n![image.png](https://assets.leetcode.com/users/images/3173cfc3-f142-4421-9e52-53d36bac1400_1689999114.0475938.png)\n![image.png](https://assets.leetcode.com/users/images/912286d9-24bd-4d09-a1af-287df6e92733_1689999122.240634.png)\n![image.png](https://assets.leetcode.com/users/images/edc0a9e1-a2b8-43d7-b5b9-e071fef130c4_1689999132.0428724.png)\n![image.png](https://assets.leetcode.com/users/images/e6f44c97-bc1d-4511-b614-9cd480fcc1c9_1689999142.0163636.png)\n\n# Code\n```C++ []\nclass Solution {\npublic:\n    unordered_map<string,double> mp;\n    int dir[8][8] = {{-2,-1},{-1,-2},{1,-2},{2,-1},{2,1},{1,2},{-1,2},{-2,1}};\n\n    double knightProbability(int n, int k, int row, int column) {\n        return find(n,k,row,column);\n    }\n\n    double find(int n, int moves, int r, int c) {\n        if(r<0 || r>=n || c<0 || c>=n)\n            return 0;\n        \n        if(moves == 0)\n            return 1;\n        \n        string key = to_string(r) + "aryan" + to_string(c) + "mittal" + to_string(moves);\n        if(mp.find(key) != mp.end())\n            return mp[key];\n        \n        double probability = 0;\n        for(int i=0; i<8; i++)\n            probability += find(n,moves-1, r+dir[i][0], c+dir[i][1])/8.0 ;\n        \n        mp[key] = probability;\n        return mp[key];\n    }\n};\n```
['Math', 'Dynamic Programming', 'Recursion', 'Probability and Statistics', 'C++']