Ans
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```java []\nclass Solution {\n    private int[][] dp;\n    private int[][] stayScore;\n    private int[][] travelScore;\n    private int n;\n    private int k;\n\n    public int maxScore(int n, int k, int[][] stayScore, int[][] travelScore) {\n        this.n = n;\n        this.k = k;\n        this.stayScore = stayScore;\n        this.travelScore = travelScore;\n\n        dp = new int[k + 1][n];\n        for (int[] row : dp) {\n            Arrays.fill(row, -1);\n        }\n\n        int result = 0;\n        for (int startCity = 0; startCity < n; ++startCity) {\n            result = Math.max(result, solve(0, startCity));\n        }\n        return result;\n    }\n\n    private int solve(int day, int curr) {\n        if (day == k) {\n            return 0;\n        }\n        if (dp[day][curr] != -1) {\n            return dp[day][curr];\n        }\n\n        int maxPoints = stayScore[day][curr] + solve(day + 1, curr);\n\n        for (int nextCity = 0; nextCity < n; ++nextCity) {\n            if (nextCity != curr) {\n                maxPoints = Math.max(maxPoints, travelScore[curr][nextCity] + solve(day + 1, nextCity));\n            }\n        }\n\n        dp[day][curr] = maxPoints;\n        return maxPoints;\n    }\n}\n```
[]