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.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.