Skip to content

Commit f17ec24

Browse files
committed
Add solution #1637
1 parent 21dd005 commit f17ec24

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 1,438 LeetCode solutions in JavaScript
1+
# 1,439 LeetCode solutions in JavaScript
22

33
[https://leetcodejavascript.com](https://leetcodejavascript.com)
44

@@ -1261,6 +1261,7 @@
12611261
1631|[Path With Minimum Effort](./solutions/1631-path-with-minimum-effort.js)|Medium|
12621262
1632|[Rank Transform of a Matrix](./solutions/1632-rank-transform-of-a-matrix.js)|Hard|
12631263
1636|[Sort Array by Increasing Frequency](./solutions/1636-sort-array-by-increasing-frequency.js)|Easy|
1264+
1637|[Widest Vertical Area Between Two Points Containing No Points](./solutions/1637-widest-vertical-area-between-two-points-containing-no-points.js)|Easy|
12641265
1657|[Determine if Two Strings Are Close](./solutions/1657-determine-if-two-strings-are-close.js)|Medium|
12651266
1668|[Maximum Repeating Substring](./solutions/1668-maximum-repeating-substring.js)|Easy|
12661267
1669|[Merge In Between Linked Lists](./solutions/1669-merge-in-between-linked-lists.js)|Medium|
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* 1637. Widest Vertical Area Between Two Points Containing No Points
3+
* https://leetcode.com/problems/widest-vertical-area-between-two-points-containing-no-points/
4+
* Difficulty: Easy
5+
*
6+
* Given n points on a 2D plane where points[i] = [xi, yi], Return the widest vertical area between
7+
* two points such that no points are inside the area.
8+
*
9+
* A vertical area is an area of fixed-width extending infinitely along the y-axis (i.e., infinite
10+
* height). The widest vertical area is the one with the maximum width.
11+
*
12+
* Note that points on the edge of a vertical area are not considered included in the area.
13+
*/
14+
15+
/**
16+
* @param {number[][]} points
17+
* @return {number}
18+
*/
19+
var maxWidthOfVerticalArea = function(points) {
20+
points.sort((a, b) => a[0] - b[0]);
21+
let result = 0;
22+
for (let i = 1; i < points.length; i++) {
23+
result = Math.max(result, points[i][0] - points[i - 1][0]);
24+
}
25+
return result;
26+
};

0 commit comments

Comments
 (0)