1499. Max Value of Equation
https://leetcode.com/problems/max-value-of-equation
Description
You are given an array points
containing the coordinates of points on a 2D plane, sorted by the x-values, where points[i] = [xi, yi]
such that xi < xj
for all 1 <= i < j <= points.length
. You are also given an integer k
.
Return the maximum value of the equation yi + yj + |xi - xj|
where |xi - xj| <= k
and 1 <= i < j <= points.length
.
It is guaranteed that there exists at least one pair of points that satisfy the constraint |xi - xj| <= k
.
Example 1:
Example 2:
Constraints:
2 <= points.length <= 105
points[i].length == 2
-108 <= xi, yi <= 108
0 <= k <= 2 * 108
xi < xj
for all1 <= i < j <= points.length
xi
form a strictly increasing sequence.
ac
Previous1498. Number of Subsequences That Satisfy the Given Sum ConditionNext1500. Design a File Sharing System
Last updated