Skip to content

Commit 337400c

Browse files
just4oncegitbook-bot
authored andcommitted
GitBook: [master] 2 pages modified
1 parent 269713b commit 337400c

File tree

2 files changed

+93
-34
lines changed

2 files changed

+93
-34
lines changed

SUMMARY.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,50 @@
33
* [README](README.md)
44
* [leetcode](leetcode/README.md)
55
* [hash-table](leetcode/hash-table/README.md)
6-
* [340-longest-substring-with-at-most-k-distinct-characters](leetcode/hash-table/340-longest-substring-with-at-most-k-distinct-characters.md)
7-
* [311-sparse-matrix-multiplication](leetcode/hash-table/311-sparse-matrix-multiplication.md)
8-
* [381-insert-delete-getrandom-o1-duplicates-allowed](leetcode/hash-table/381-insert-delete-getrandom-o1-duplicates-allowed.md)
9-
* [356-line-reflection](leetcode/hash-table/356-line-reflection.md)
10-
* [387-first-unique-character-in-a-string](leetcode/hash-table/387-first-unique-character-in-a-string.md)
11-
* [336-palindrome-pairs](leetcode/hash-table/336-palindrome-pairs.md)
12-
* [030-substring-with-concatenation-of-all-words](leetcode/hash-table/030-substring-with-concatenation-of-all-words.md)
13-
* [159-longest-substring-with-at-most-two-distinct-characters](leetcode/hash-table/159-longest-substring-with-at-most-two-distinct-characters.md)
14-
* [447-number-of-boomerangs](leetcode/hash-table/447-number-of-boomerangs.md)
15-
* [347-top-k-frequent-elements](leetcode/hash-table/347-top-k-frequent-elements.md)
16-
* [246-strobogrammatic-number](leetcode/hash-table/246-strobogrammatic-number.md)
17-
* [359-logger-rate-limiter](leetcode/hash-table/359-logger-rate-limiter.md)
18-
* [217-contains-duplicate](leetcode/hash-table/217-contains-duplicate.md)
19-
* [166-fraction-to-recurring-decimal](leetcode/hash-table/166-fraction-to-recurring-decimal.md)
20-
* [290-word-pattern](leetcode/hash-table/290-word-pattern.md)
21-
* [242-valid-anagram](leetcode/hash-table/242-valid-anagram.md)
22-
* [219-contains-duplicate-ii](leetcode/hash-table/219-contains-duplicate-ii.md)
23-
* [076-minimum-window-substring](leetcode/hash-table/076-minimum-window-substring.md)
24-
* [244-shortest-word-distance-ii](leetcode/hash-table/244-shortest-word-distance-ii.md)
25-
* [288-unique-word-abbreviation](leetcode/hash-table/288-unique-word-abbreviation.md)
26-
* [202-happy-number](leetcode/hash-table/202-happy-number.md)
276
* [003-longest-substring-without-repeating-characters](leetcode/hash-table/003-longest-substring-without-repeating-characters.md)
7+
* [030-substring-with-concatenation-of-all-words](leetcode/hash-table/030-substring-with-concatenation-of-all-words.md)
8+
* [036-valid-sudoku](leetcode/hash-table/036-valid-sudoku.md)
9+
* [037-sudoku-solver](leetcode/hash-table/037-sudoku-solver.md)
2810
* [049-group-anagrams](leetcode/hash-table/049-group-anagrams.md)
29-
* [266-palindrome-permutation](leetcode/hash-table/266-palindrome-permutation.md)
30-
* [409-longest-palindrome](leetcode/hash-table/409-longest-palindrome.md)
31-
* [325-maximum-size-subarray-sum-equals-k](leetcode/hash-table/325-maximum-size-subarray-sum-equals-k.md)
11+
* [076-minimum-window-substring](leetcode/hash-table/076-minimum-window-substring.md)
3212
* [094-binary-tree-inorder-traversal](leetcode/hash-table/094-binary-tree-inorder-traversal.md)
3313
* [136-single-number](leetcode/hash-table/136-single-number.md)
14+
* [138-copy-list-with-random-pointer](leetcode/hash-table/138-copy-list-with-random-pointer.md)
15+
* [149-max-points-on-a-line](leetcode/hash-table/149-max-points-on-a-line.md)
16+
* [159-longest-substring-with-at-most-two-distinct-characters](leetcode/hash-table/159-longest-substring-with-at-most-two-distinct-characters.md)
17+
* [166-fraction-to-recurring-decimal](leetcode/hash-table/166-fraction-to-recurring-decimal.md)
18+
* [170-two-sum-iii-data-structure-design](leetcode/hash-table/170-two-sum-iii-data-structure-design.md)
19+
* [187-repeated-dna-sequences](leetcode/hash-table/187-repeated-dna-sequences.md)
20+
* [202-happy-number](leetcode/hash-table/202-happy-number.md)
3421
* [204-count-primes](leetcode/hash-table/204-count-primes.md)
3522
* [205-isomorphic-strings](leetcode/hash-table/205-isomorphic-strings.md)
36-
* [389-find-the-difference](leetcode/hash-table/389-find-the-difference.md)
37-
* [299-bulls-and-cows](leetcode/hash-table/299-bulls-and-cows.md)
38-
* [187-repeated-dna-sequences](leetcode/hash-table/187-repeated-dna-sequences.md)
39-
* [380-insert-delete-getrandom-o1](leetcode/hash-table/380-insert-delete-getrandom-o1.md)
23+
* [217-contains-duplicate](leetcode/hash-table/217-contains-duplicate.md)
24+
* [219-contains-duplicate-ii](leetcode/hash-table/219-contains-duplicate-ii.md)
25+
* [242-valid-anagram](leetcode/hash-table/242-valid-anagram.md)
26+
* [244-shortest-word-distance-ii](leetcode/hash-table/244-shortest-word-distance-ii.md)
27+
* [246-strobogrammatic-number](leetcode/hash-table/246-strobogrammatic-number.md)
4028
* [249-group-shifted-strings](leetcode/hash-table/249-group-shifted-strings.md)
41-
* [170-two-sum-iii-data-structure-design](leetcode/hash-table/170-two-sum-iii-data-structure-design.md)
42-
* [149-max-points-on-a-line](leetcode/hash-table/149-max-points-on-a-line.md)
43-
* [037-sudoku-solver](leetcode/hash-table/037-sudoku-solver.md)
29+
* [266-palindrome-permutation](leetcode/hash-table/266-palindrome-permutation.md)
4430
* [274-h-index](leetcode/hash-table/274-h-index.md)
45-
* [358-rearrange-string-k-distance-apart](leetcode/hash-table/358-rearrange-string-k-distance-apart.md)
46-
* [036-valid-sudoku](leetcode/hash-table/036-valid-sudoku.md)
31+
* [288-unique-word-abbreviation](leetcode/hash-table/288-unique-word-abbreviation.md)
32+
* [290-word-pattern](leetcode/hash-table/290-word-pattern.md)
33+
* [299-bulls-and-cows](leetcode/hash-table/299-bulls-and-cows.md)
34+
* [311-sparse-matrix-multiplication](leetcode/hash-table/311-sparse-matrix-multiplication.md)
4735
* [314-binary-tree-vertical-order-traversal](leetcode/hash-table/314-binary-tree-vertical-order-traversal.md)
48-
* [138-copy-list-with-random-pointer](leetcode/hash-table/138-copy-list-with-random-pointer.md)
36+
* [325-maximum-size-subarray-sum-equals-k](leetcode/hash-table/325-maximum-size-subarray-sum-equals-k.md)
37+
* [336-palindrome-pairs](leetcode/hash-table/336-palindrome-pairs.md)
38+
* [340-longest-substring-with-at-most-k-distinct-characters](leetcode/hash-table/340-longest-substring-with-at-most-k-distinct-characters.md)
39+
* [347-top-k-frequent-elements](leetcode/hash-table/347-top-k-frequent-elements.md)
40+
* [356-line-reflection](leetcode/hash-table/356-line-reflection.md)
41+
* [358-rearrange-string-k-distance-apart](leetcode/hash-table/358-rearrange-string-k-distance-apart.md)
42+
* [359-logger-rate-limiter](leetcode/hash-table/359-logger-rate-limiter.md)
43+
* [380-insert-delete-getrandom-o1](leetcode/hash-table/380-insert-delete-getrandom-o1.md)
44+
* [381-insert-delete-getrandom-o1-duplicates-allowed](leetcode/hash-table/381-insert-delete-getrandom-o1-duplicates-allowed.md)
45+
* [387-first-unique-character-in-a-string](leetcode/hash-table/387-first-unique-character-in-a-string.md)
46+
* [389-find-the-difference](leetcode/hash-table/389-find-the-difference.md)
47+
* [409-longest-palindrome](leetcode/hash-table/409-longest-palindrome.md)
4948
* [438-find-all-anagrams-in-a-string](leetcode/hash-table/438-find-all-anagrams-in-a-string.md)
49+
* [447-number-of-boomerangs](leetcode/hash-table/447-number-of-boomerangs.md)
5050
* [math](leetcode/math/README.md)
5151
* [065-valid-number](leetcode/math/065-valid-number.md)
5252
* [013-roman-to-integer](leetcode/math/013-roman-to-integer.md)
@@ -177,6 +177,7 @@
177177
* [475-heaters](leetcode/binary-search/475-heaters.md)
178178
* [270-closest-binary-search-tree-value](leetcode/binary-search/270-closest-binary-search-tree-value.md)
179179
* [483-smallest-good-base](leetcode/binary-search/483-smallest-good-base.md)
180+
* [778-swim-in-rising-water](leetcode/binary-search/778-swim-in-rising-water.md)
180181
* [two-pointers](leetcode/two-pointers/README.md)
181182
* [632-smallest-range](leetcode/two-pointers/632-smallest-range.md)
182183
* [350-intersection-of-two-arrays-ii](leetcode/two-pointers/350-intersection-of-two-arrays-ii.md)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 778-swim-in-rising-water
2+
3+
## Question {#question}
4+
5+
[https://leetcode.com/problems/swim-in-rising-water/description/](https://leetcode.com/problems/swim-in-rising-water/description/)
6+
7+
On an N x N grid, each square grid\[i\]\[j\] represents the elevation at that point \(i,j\).
8+
9+
Now rain starts to fall. At time t, the depth of the water everywhere is t. You can swim from a square to another 4-directionally adjacent square if and only if the elevation of both squares individually are at most t. You can swim infinite distance in zero time. Of course, you must stay within the boundaries of the grid during your swim.
10+
11+
You start at the top left square \(0, 0\). What is the least time until you can reach the bottom right square \(N-1, N-1\)?
12+
13+
**Example 1:**
14+
15+
```text
16+
Input: [[0,2],[1,3]]
17+
Output: 3
18+
Explanation:
19+
At time 0, you are in grid location (0, 0).
20+
You cannot go anywhere else because 4-directionally adjacent neighbors have a higher elevation than t = 0.
21+
22+
You cannot reach point (1, 1) until time 3.
23+
When the depth of water is 3, we can swim anywhere inside the grid.
24+
```
25+
26+
**Example 2:**
27+
28+
```text
29+
Input: [[0,1,2,3,4],[24,23,22,21,5],[12,13,14,15,16],[11,17,18,19,20],[10,9,8,7,6]]
30+
Output: 16
31+
Explanation:
32+
0 1 2 3 4
33+
24 23 22 21 5
34+
12 13 14 15 16
35+
11 17 18 19 20
36+
10 9 8 7 6
37+
38+
The final route is marked in bold.
39+
We need to wait until time 16 so that (0, 0) and (4, 4) are connected.
40+
```
41+
42+
**Note:**
43+
44+
1. 2 <= N <= 50.
45+
2. grid\[i\]\[j\] is a permutation of \[0, ..., N\*N - 1\].
46+
47+
## Thought Process {#thought-process}
48+
49+
1. asd
50+
51+
## Solution
52+
53+
```java
54+
55+
```
56+
57+
## Additional {#additional}
58+

0 commit comments

Comments
 (0)