Widest Vertical Area Between Two Points Containing No Points

Satish Pednekar

· 1 min read
Post Thumbnail Main Image

Widest Vertical Area Between Two Points Containing No Points

Given n points on a 2D plane where points[i] = [xi, yi], Return the widest vertical area between two points such that no points are inside the area.

A vertical area is an area of fixed-width extending infinitely along the y-axis (i.e., infinite height). The widest vertical area is the one with the maximum width.

Note that points on the edge of a vertical area are not considered included in the area.


Example 1:

Image
Input: points = [[8,7],[9,9],[7,4],[9,7]]
Output: 1
Explanation: Both the red and the blue area are optimal.

Example 2:

Input: points = [[3,1],[9,0],[1,0],[1,4],[5,3],[8,8]]
Output: 3


Constraints:

  • n == points.length
  • 2 <= n <= 105
  • points[i].length == 2
  • 0 <= xi, yi <= 109

Frontendpedia Platform

Turn this article into a learning plan

Our companion platform helps you follow structured learning paths and track your frontend skills over time. Free to start, with paid plans for professionals who want to go deeper.

Explore the platform
Satish Pednekar

About Satish Pednekar

Technical consultant | System Design | AI Strategy | Experimentalist

Admin @ www.frontendpedia.com

Thumbnail

Array - searching

Kids With the Greatest Number of Candies There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCandies, denoting the number of extra candies that you have. Return a boolean array result of

Satish Pednekar