You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leetcode/binary-search/497-random-point-in-non-overlapping-rectangles.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,15 @@
4
4
5
5
Given a list of non-overlapping axis-aligned rectangles rects, write a function pick which randomly and uniformily picks an integer point in the space covered by the rectangles.
6
6
7
-
**Note:**
8
-
9
-
1. An integer point is a point that has integer coordinates.
10
-
2. A point on the perimeter of a rectangle is included in the space covered by the rectangles.
11
-
3. ith rectangle = rects\[i\] = \[x1,y1,x2,y2\], where \[x1, y1\] are the integer coordinates of the bottom-left corner, and \[x2, y2\] are the integer coordinates of the top-right corner.
12
-
4. length and width of each rectangle does not exceed 2000.
13
-
5. 1 <= rects.length <= 100
14
-
6. pick return a point as an array of integer coordinates \[p\_x, p\_y\]
7
+
**Note:
8
+
**
9
+
10
+
1. An integer point is a point that has integer coordinates.
11
+
2. A point on the perimeter of a rectangle is included in the space covered by the rectangles.
12
+
3. ith rectangle = rects\[i\] = \[x1,y1,x2,y2\], where \[x1, y1\] are the integer coordinates of the bottom-left corner, and \[x2, y2\] are the integer coordinates of the top-right corner.
13
+
4. length and width of each rectangle does not exceed 2000.
14
+
5. 1 <= rects.length <= 100
15
+
6. pick return a point as an array of integer coordinates \[p\_x, p\_y\]
15
16
7. pick is called at most 10000 times.
16
17
17
18
**Example 1:**
@@ -34,7 +35,8 @@ Output:
34
35
[null,[-1,-2],[2,0],[-2,-1],[3,0],[-2,-2]]
35
36
```
36
37
37
-
**Explanation of Input Syntax:**
38
+
**Explanation of Input Syntax:
39
+
**
38
40
39
41
The input is two lists: the subroutines called and their arguments. Solution's constructor has one argument, the array of rectangles rects. pick has no arguments. Arguments are always wrapped with a list, even if there aren't any.
0 commit comments