Beats 99.80% users with C++ in time complexity.
Intuition\nIntuition is simple and that is we have to try all possible options on each day of travelling.\n\n# Approach\nJust approached it like a basic 2d DP t
# Intuition\nIntuition is simple and that is we have to try all possible options on each day of travelling.\n\n# Approach\nJust approached it like a basic 2d DP that is available in striver\'s sheet too.\n\n# Complexity\n- Time complexity:\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 maxScore(int n, int k, vector<vector<int>>& stayScore,\n                 vector<vector<int>>& travelScore) {\n        vector<vector<int>> dp(k, vector<int>(n, -1));\n        for (int i = 0; i < n; i++) {\n            int stay = stayScore[k - 1][i];\n            int travel = INT_MIN;\n            for (int j = 0; j < travelScore[i].size(); j++) {\n                travel = max(travel, travelScore[i][j]);\n            }\n            dp[k - 1][i] = max(stay, travel);\n        }\n        for (int i = k - 2; i >= 0; i--) {\n            for (int j = 0; j < n; j++) {\n                int stay = stayScore[i][j] + dp[i + 1][j];\n                int travel = INT_MIN;\n                for (int k = 0; k < travelScore[j].size(); k++) {\n                    travel = max(travel, travelScore[j][k] + dp[i + 1][k]);\n                }\n                dp[i][j] = max(stay, travel);\n            }\n        }\n        int ans = INT_MIN;\n        for (int i = 0; i < n; i++) {\n            ans = max(ans, dp[0][i]);\n        }\n        return ans;\n    }\n};\n```
[]