Problem 1014 · Medium

Best Sightseeing Pair

Pick two sightseeing spots to maximize the sum of their values minus the distance between them. A running best score updates as the scan passes each spot.

Open the interactive visualisation