Easiest Recursive Memoized [DP + Bitmask] C++
\nclass Solution {\npublic:\n    \n    short DP[52][52][52][52] ;\n    // x,y --> a,b\n    short getMoves(int X, int Y, int A, int B){\n        \n        if(DP[
```\nclass Solution {\npublic:\n    \n    short DP[52][52][52][52] ;\n    // x,y --> a,b\n    short getMoves(int X, int Y, int A, int B){\n        \n        if(DP[X][Y][A][B] != -1)\n            return DP[X][Y][A][B];\n        \n        queue<pair<int,pair<int,int>>> Q; \n        Q.push({0,{X,Y}});\n        vector<vector<bool>> visited(52, vector<bool>(52, false));\n        visited[X][Y] = true;\n        \n        while(!Q.empty()){\n            int step = Q.front().first;\n            int x = Q.front().second.first;\n            int y = Q.front().second.second;\n            Q.pop();\n            \n            if(x==A && y==B) return DP[X][Y][A][B] = DP[A][B][X][Y] = step;\n            \n            if(x-2>=0 && y-1>=0 && visited[x-2][y-1]==false){\n                visited[x-2][y-1] = true;\n                Q.push({step+1, {x-2, y-1}});\n            }\n            \n            if(x-2>=0 && y+1<50 && visited[x-2][y+1]==false){\n                visited[x-2][y+1] = true;\n                Q.push({step+1, {x-2, y+1}});\n            }\n            \n            if(x-1>=0 && y+2<50 && visited[x-1][y+2]==false){\n                visited[x-1][y+2] = true;\n                Q.push({step+1, {x-1, y+2}});\n            }\n            \n            if(x+1<50 && y+2<50 && visited[x+1][y+2]==false){\n                visited[x+1][y+2] = true;\n                Q.push({step+1, {x+1, y+2}});\n            }\n            \n            if(x+2<50 && y+1<50 && visited[x+2][y+1]==false){\n                visited[x+2][y+1] = true;\n                Q.push({step+1, {x+2, y+1}});\n            }\n            \n            if(x+2<50 && y-1>=0 && visited[x+2][y-1]==false){\n                visited[x+2][y-1] = true;\n                Q.push({step+1, {x+2, y-1}});\n            }\n            \n            if(x+1<50 && y-2>=0 && visited[x+1][y-2]==false){\n                visited[x+1][y-2] = true;\n                Q.push({step+1, {x+1, y-2}});\n            }\n            \n            if(x-1>=0 && y-2>=0 && visited[x-1][y-2]==false){\n                visited[x-1][y-2] = true;\n                Q.push({step+1, {x-1, y-2}});\n            }   \n        }\n        \n        return 1e7;\n    }\n    \n    int MASK;\n    int t[17][32770][2];\n    \n    int Solve(vector<vector<int>>&A, int ind, int mask, bool aliceTurn){\n        if(mask == MASK) return 0;\n        \n        if(t[ind][mask][aliceTurn]!=-1)\n            return t[ind][mask][aliceTurn];\n        \n        if(aliceTurn){\n            int Ans = 0 ;\n            for(int i=0; i<A.size(); i++){\n                if( (mask&(1<<i)) == 0){\n                    Ans = max(Ans, Solve(A, i, mask|(1<<i), false) +  getMoves(A[ind][0], A[ind][1], A[i][0], A[i][1]) );\n                }\n            }\n            return t[ind][mask][aliceTurn] = Ans;\n        }\n        else{\n            \n            int Ans = 1e9 ;\n            for(int i=0; i<A.size(); i++){\n                if( (mask&(1<<i)) == 0){\n                    Ans = min(Ans, Solve(A, i, mask|(1<<i), true) +  getMoves(A[ind][0], A[ind][1], A[i][0], A[i][1]) );\n                }\n            }\n            \n            return t[ind][mask][aliceTurn] = Ans;\n        }\n        \n        return -1;\n    }\n    \n    int maxMoves(int kx, int ky, vector<vector<int>>& A) {     \n        int Ans = 0;\n        int mask = 0 ;\n        \n        MASK = (1<<A.size()) - 1; \n        memset(t,-1,sizeof(t)) ;\n        memset(DP,-1,sizeof(DP));\n\n        for(int i=0; i<A.size(); i++){\n            Ans = max(Ans, Solve(A, i, mask|(1<<i), false) + getMoves(kx, ky, A[i][0], A[i][1]));\n        }\n        \n        return Ans;\n    }\n};\n```
['Recursion', 'Memoization', 'C', 'Bitmask']