Practice Max Value of Equation
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Max Value of Equation
Problem Statement
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.
Source: Max Value of Equation on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
points = [[1,3],[2,0],[5,10],[6,-10]], k = 1
4
# Example 2
points = [[0,0],[3,0],[9,2]], k = 3
3
Constraints
Related LeetCode Problems
Practice more problems similar to Max Value of Equation.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.