← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Practice/Meta/Leetcode 568. Maximum Vacation Days
CodingMust
You're planning an extended vacation across multiple cities over several weeks. You start in city 0 and need to maximize the total number of vacation days you can enjoy.
You are given:
flights where flights[i][j] equals 1 if there is a direct flight from city i to city j, and 0 otherwise. Note that flights[i][i] equals 0 or 1, indicating whether you can stay in city i.days where days[i][k] represents the number of vacation days you can enjoy in city i during week k.At the beginning of each week, you can choose to either:
flights[currentCity][currentCity] equals 1 or you just want to stay), orj (if flights[currentCity][j] equals 1)Return the maximum number of vacation days you can accumulate over all weeks.
flights[i][j] equals 1n == flights.length (number of cities)n == flights[i].lengthn == days.lengthk == days[i].length (number of weeks)1 <= n, k <= 100flights[i][j] is either 0 or 10 <= days[i][j] <= 7Example 1:
` Input: flights = [[0,1],[1,0]], days = [[1,3],[3,2]] Output: 7 Explanation:
Example 2:
` Input: flights = [[0,0,0],[0,0,0],[0,0,0]], days = [[1,1,1],[7,7,7],[7,7,7]] Output: 3 Explanation:
Example 3:
` Input: flights = [[0,1,1],[1,0,1],[1,1,0]], days = [[1,3,1],[3,1,3],[1,3,1]] Output: 12 Explanation: