Skip to content

Practice Maximum Points Tourist Can Earn

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3332
LeetCode Problem

Maximum Points Tourist Can Earn

Problem Statement

A tourist may start in any of n cities and travels for exactly k days. On day d, staying in city c earns stayScore[d][c]; moving from c to a different city t earns travelScore[c][t]. Choose exactly one of these actions each day. Return the greatest total score.

Source: Maximum Points Tourist Can Earn on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 2, k = 1, stayScore = [[2,3]], travelScore = [[0,2],[1,0]]
Output
3

# Example 2

Input
n = 3, k = 2, stayScore = [[3,4,2],[2,1,2]], travelScore = [[0,2,1],[2,0,4],[3,2,0]]
Output
8

Constraints

1 <= n <= 200
1 <= k <= 200
n == travelScore.length == travelScore[i].length == stayScore[i].length
k == stayScore.length
1 <= stayScore[i][j] <= 100
0 <= travelScore[i][j] <= 100
travelScore[i][i] == 0

Related LeetCode Problems

Practice more problems similar to Maximum Points Tourist Can Earn.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.