#3332

Maximum Points Tourist Can Earn

specialist · 920 · lc medium +32 · 47.5% accepted · 91 likes · top 32%

Description

You are given integers n and k, along with two 2D integer arrays stayScore and travelScore.

A tourist visits a country with n cities, all directly connected to each other. The journey spans exactly k days (0-indexed), and the tourist may start from any city.

Each day the tourist can:

- Stay in their current city curr on day i, earning stayScore[i][curr] points.

- Travel from city curr to any other city dest, earning travelScore[curr][dest] points.

Return the maximum total points the tourist can earn.

Code

1
2
3