Skip to content

Commit 64cb4d8

Browse files
committed
Updates leetcode/binary-search/497-random-point-in-non-overlapping-rectangles.md
Auto commit by GitBook Editor
1 parent 7ff73f6 commit 64cb4d8

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@
250250
* [454-4Sum II](leetcode/binary-search/454-4sum-ii.md)
251251
* [475-Heaters](leetcode/binary-search/475-heaters.md)
252252
* [483-Smallest Good Base](leetcode/binary-search/483-smallest-good-base.md)
253+
* [497-Random Point in Non-overlapping Rectangles](leetcode/binary-search/497-random-point-in-non-overlapping-rectangles.md)
253254
* [644-Maximum Average Subarray II](leetcode/binary-search/644-maximum-average-subarray-ii.md)
254255
* [658-Find K Closest Elements](leetcode/binary-search/658-find-k-closest-elements.md)
255256
* [668-Kth Smallest Number in Multiplication Table](leetcode/binary-search/668-kth-smallest-number-in-multiplication-table.md)

leetcode/binary-search/497-random-point-in-non-overlapping-rectangles.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
### Question {#question}
2+
3+
[https://leetcode.com/problems/random-point-in-non-overlapping-rectangles/description/](https://leetcode.com/problems/random-point-in-non-overlapping-rectangles/description/)
4+
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+
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\]
15+
7. pick is called at most 10000 times.
16+
17+
**Example 1:**
18+
19+
```
20+
Input:
21+
["Solution","pick","pick","pick"]
22+
[[[[1,1,5,5]]],[],[],[]]
23+
Output:
24+
[null,[4,1],[4,1],[3,3]]
25+
```
26+
27+
**Example 2:**
28+
29+
```
30+
Input:
31+
["Solution","pick","pick","pick","pick","pick"]
32+
[[[[-2,-2,-1,-1],[1,0,3,0]]],[],[],[],[],[]]
33+
Output:
34+
[null,[-1,-2],[2,0],[-2,-1],[3,0],[-2,-2]]
35+
```
36+
37+
**Explanation of Input Syntax:**
38+
39+
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.
40+
41+
### Thought Process {#thought-process}
42+
43+
1. asd
44+
45+
### Solution
46+
47+
```java
48+
49+
```
50+
51+
### Additional {#additional}
52+
53+
54+

0 commit comments

Comments
 (0)