Leetcode 1499. Max Value of Equation
Given points sorted by x, find the maximum value of yi + yj + |xi - xj| for pairs with |xi - xj| ≤ k. Transforming the expression to (yi - xi) + (yj + xj) for i < j shows you must efficiently maintain the maximum (yi - xi) among prior points within an x-distance k to evaluate each j.
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.