Simple recursive solution
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 mod = 1e9;\n    int solve(int n, int k, vector<vector<int>>& stayScore, vector<vector<int>>& travelScore,int day,int city,vector<vector<int>> &dp){\n        if(k == day){\n            return 0;\n        }\n        if(dp[day][city] != -1){\n            return dp[day][city];\n        }\n        int maxi = -1;\n        for(int i = 0;i<n;i++){\n            int temp = solve(n,k,stayScore,travelScore,day+1,i,dp);\n\n            if(i == city){\n                temp += stayScore[day][i];\n            }\n            if(i != city){\n                temp += travelScore[city][i];\n            }\n            maxi = maxi%mod;\n            maxi = max(temp,maxi);\n        }\n        return dp[day][city] = maxi;\n    }\n    int maxScore(int n, int k, vector<vector<int>>& stayScore, vector<vector<int>>& travelScore) {\n        int maxAns = 0;\n        vector<vector<int>> dp(k,vector<int>(n,-1));\n        for(int i = 0;i<n;i++){\n            int temp = solve(n,k,stayScore,travelScore,0,i,dp);\n            maxAns = max(maxAns,temp);\n        }\n        return maxAns;\n    }\n};\n```
[]