1637. Widest Vertical Area Between Two Points Containing No Points Medium

@problem@discussion
#Array#Sorting



1/**
2 * [1637] Widest Vertical Area Between Two Points Containing No Points
3 *
4 * 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.
5 * 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.
6 * Note that points on the edge of a vertical area are not considered included in the area.
7 *  
8 * Example 1:
9 * <img alt="" src="https://assets.leetcode.com/uploads/2020/09/19/points3.png" style="width: 276px; height: 371px;" />​
10 * Input: points = [[8,7],[9,9],[7,4],[9,7]]
11 * Output: 1
12 * Explanation: Both the red and the blue area are optimal.
13 * 
14 * Example 2:
15 * 
16 * Input: points = [[3,1],[9,0],[1,0],[1,4],[5,3],[8,8]]
17 * Output: 3
18 * 
19 *  
20 * Constraints:
21 * 
22 * 	n == points.length
23 * 	2 <= n <= 10^5
24 * 	points[i].length == 2
25 * 	0 <= xi, yi <= 10^9
26 * 
27 */
28pub struct Solution {}
29
30// problem: https://leetcode.com/problems/widest-vertical-area-between-two-points-containing-no-points/
31// discuss: https://leetcode.com/problems/widest-vertical-area-between-two-points-containing-no-points/discuss/?currentPage=1&orderBy=most_votes&query=
32
33// submission codes start here
34
35impl Solution {
36    pub fn max_width_of_vertical_area(points: Vec<Vec<i32>>) -> i32 {
37        0
38    }
39}
40
41// submission codes end
42
43#[cfg(test)]
44mod tests {
45    use super::*;
46
47    #[test]
48    fn test_1637() {
49    }
50}
51


Back
© 2025 bowen.ge All Rights Reserved.