❄ Easy Java Solution ❄ Beats 96% of Java Users .
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        public int maxScore(int n, int k, int[][] stayScore, int[][] travelScore) {\n        int[] dp = new int[n];\n        for (int i = 0; i < k; ++i) {\n            int[] dp2 = dp.clone();\n            for (int curr = 0; curr < n; ++curr)\n                dp2[curr] += stayScore[i][curr];\n            for (int curr = 0; curr < n; ++curr)\n                for (int dest = 0; dest < n; ++dest)\n                    dp2[dest] = Math.max(dp2[dest], dp[curr] + travelScore[curr][dest]);\n            dp = dp2;\n        }\n        int rs = 0 ; \n        for(int i:dp){\n            rs = Math.max( rs , i ) ; \n        }\n        return rs ; \n    }\n}\n```
[]