easy memoized DP solution intuitive approach!!!
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int f(int i,int curr,int n, int k, vector<vector<int>>& stayScore, vector<vector<int>>& travelScore,vector<vector<int>>& dp){\n        if(i==k) return 0;\n        if(dp[i][curr]!=-1) return dp[i][curr];\n        else{\n            int ans=-1e9;\n            int stay=f(i+1,curr,n,k,stayScore,travelScore,dp)+stayScore[i][curr];\n            for(int x=0;x<n;x++){\n                if(curr!=x){\n                    ans=max(ans,f(i+1,x,n,k,stayScore,travelScore,dp)+travelScore[curr][x]);\n                }\n            }\n            return dp[i][curr]=max(ans,stay);\n        }\n    }\n    int maxScore(int n, int k, vector<vector<int>>& stayScore, vector<vector<int>>& travelScore) {\n        int ans=-1e9;\n        vector<vector<int>> dp(k+2,vector<int>(n+2,-1));\n        for(int i=0;i<n;i++){\n            ans=max(ans,f(0,i,n,k,stayScore,travelScore,dp));\n        }\n        return ans;\n    }\n};\n```
[]