Search
⌘K
Get Premium
Leetcode 1014. Best Sightseeing Pair
Given an array values, find the maximum score values[i] + values[j] + i - j for i < j, which reduces to maximizing (values[i] + i) + (values[j] - j); the optimal O(n) approach scans once while tracking the best left term.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.