Easy JS Solution using DP
\n# Code\njavascript []\n/**\n * @param {number} n\n * @param {number} k\n * @param {number[][]} stayScore\n * @param {number[][]} travelScore\n * @return {numb
\n# Code\n```javascript []\n/**\n * @param {number} n\n * @param {number} k\n * @param {number[][]} stayScore\n * @param {number[][]} travelScore\n * @return {number}\n */\nvar maxScore = function (n, k, stayScore, travelScore) {\n    const dp = Array.from({length: n} ,() => Array(k).fill(-1))\n\n    const findVal = (city, date)=>{\n        if(date === k){\n            return 0\n        }\n        if(dp[city][date] !== -1){\n            return dp[city][date]\n        }\n        const stay = stayScore[date][city]+findVal(city, date+1)\n        let move = 0;\n        for(let i = 0 ; i < n; i++){\n            move = Math.max(move, travelScore[city][i] + findVal(i, date+1))\n        }\n        dp[city][date] = Math.max(stay,move);\n        return Math.max(stay, move)\n    }\n    let ans = 0;\n    for(let i = 0 ; i < n; i++){\n        ans= Math.max(ans, findVal(i, 0))\n    }\n    return ans;\n};\n```
[]