Memoization
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 {\n    vector<vector<int>> ss,ts;\n    int helper(int day,int city,int n,int k,vector<vector<int>> &dp){\n        if(day == k){return 0;}\n        if(dp[day][city] != -1){return dp[day][city];}\n        int ans=ss[day][city]+helper(day+1,city,n,k,dp);\n        for(int newcity=0;newcity<n;newcity++){\n            if(newcity == city){continue;}\n            ans=max(ans,ts[city][newcity]+helper(day+1,newcity,n,k,dp));\n        }\n        return dp[day][city]=ans;\n    }\npublic:\n    int maxScore(int n, int k, vector<vector<int>>& stayScore, vector<vector<int>>& travelScore) {\n        ss=stayScore;\n        ts=travelScore;\n        int ans=0;\n        vector<vector<int>> dp(k+1,vector<int>(n+1,-1));\n        for(int city=0;city<n;city++){\n            ans=max(ans,helper(0,city,n,k,dp));\n        }\n        return ans;\n    }\n};\n```
[]