mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-12 06:36:42 +08:00
1. Add solution 1091、1614、1619、1624、1629、1636、1704
2. ctl strings.TrimSpace question.Title
This commit is contained in:
@ -61,5 +61,5 @@ func duplicateZeros(arr []int) {
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1079.Letter-Tile-Possibilities/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1093.Statistics-from-a-Large-Sample/">下一页➡️</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1091.Shortest-Path-in-Binary-Matrix/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -0,0 +1,121 @@
|
||||
# [1091. Shortest Path in Binary Matrix](https://leetcode.com/problems/shortest-path-in-binary-matrix/)
|
||||
|
||||
|
||||
## 题目
|
||||
|
||||
In an N by N square grid, each cell is either empty (0) or blocked (1).
|
||||
|
||||
A *clear path from top-left to bottom-right* has length `k` if and only if it is composed of cells `C_1, C_2, ..., C_k` such that:
|
||||
|
||||
- Adjacent cells `C_i` and `C_{i+1}` are connected 8-directionally (ie., they are different and share an edge or corner)
|
||||
- `C_1` is at location `(0, 0)` (ie. has value `grid[0][0]`)
|
||||
- `C_k` is at location `(N-1, N-1)` (ie. has value `grid[N-1][N-1]`)
|
||||
- If `C_i` is located at `(r, c)`, then `grid[r][c]` is empty (ie. `grid[r][c] == 0`).
|
||||
|
||||
Return the length of the shortest such clear path from top-left to bottom-right. If such a path does not exist, return -1.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: [[0,1],[1,0]]
|
||||
Output: 2
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: [[0,0,0],[1,1,0],[1,1,0]]
|
||||
Output: 4
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
**Note:**
|
||||
|
||||
1. `1 <= grid.length == grid[0].length <= 100`
|
||||
2. `grid[r][c]` is `0` or `1`
|
||||
|
||||
## 题目大意
|
||||
|
||||
在一个 N × N 的方形网格中,每个单元格有两种状态:空(0)或者阻塞(1)。一条从左上角到右下角、长度为 k 的畅通路径,由满足下述条件的单元格 C_1, C_2, ..., C_k 组成:
|
||||
|
||||
- 相邻单元格 C_i 和 C_{i+1} 在八个方向之一上连通(此时,C_i 和 C_{i+1} 不同且共享边或角)
|
||||
- C_1 位于 (0, 0)(即,值为 grid[0][0])
|
||||
- C_k 位于 (N-1, N-1)(即,值为 grid[N-1][N-1])
|
||||
- 如果 C_i 位于 (r, c),则 grid[r][c] 为空(即,grid[r][c] == 0)
|
||||
|
||||
返回这条从左上角到右下角的最短畅通路径的长度。如果不存在这样的路径,返回 -1 。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 这一题是简单的找最短路径。利用 BFS 从左上角逐步扩展到右下角,便可以很容易求解。注意每轮扩展需要考虑 8 个方向。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
var dir = [][]int{
|
||||
{-1, -1},
|
||||
{-1, 0},
|
||||
{-1, 1},
|
||||
{0, 1},
|
||||
{0, -1},
|
||||
{1, -1},
|
||||
{1, 0},
|
||||
{1, 1},
|
||||
}
|
||||
|
||||
func shortestPathBinaryMatrix(grid [][]int) int {
|
||||
visited := make([][]bool, 0)
|
||||
for range make([]int, len(grid)) {
|
||||
visited = append(visited, make([]bool, len(grid[0])))
|
||||
}
|
||||
dis := make([][]int, 0)
|
||||
for range make([]int, len(grid)) {
|
||||
dis = append(dis, make([]int, len(grid[0])))
|
||||
}
|
||||
if grid[0][0] == 1 {
|
||||
return -1
|
||||
}
|
||||
if len(grid) == 1 && len(grid[0]) == 1 {
|
||||
return 1
|
||||
}
|
||||
|
||||
queue := []int{0}
|
||||
visited[0][0], dis[0][0] = true, 1
|
||||
for len(queue) > 0 {
|
||||
cur := queue[0]
|
||||
queue = queue[1:]
|
||||
curx, cury := cur/len(grid[0]), cur%len(grid[0])
|
||||
for d := 0; d < 8; d++ {
|
||||
nextx := curx + dir[d][0]
|
||||
nexty := cury + dir[d][1]
|
||||
if isInBoard(grid, nextx, nexty) && !visited[nextx][nexty] && grid[nextx][nexty] == 0 {
|
||||
queue = append(queue, nextx*len(grid[0])+nexty)
|
||||
visited[nextx][nexty] = true
|
||||
dis[nextx][nexty] = dis[curx][cury] + 1
|
||||
if nextx == len(grid)-1 && nexty == len(grid[0])-1 {
|
||||
return dis[nextx][nexty]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func isInBoard(board [][]int, x, y int) bool {
|
||||
return x >= 0 && x < len(board) && y >= 0 && y < len(board[0])
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1089.Duplicate-Zeros/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1093.Statistics-from-a-Large-Sample/">下一页➡️</a></p>
|
||||
</div>
|
@ -97,6 +97,6 @@ func sampleStats(count []int) []float64 {
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1089.Duplicate-Zeros/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1000~1099/1091.Shortest-Path-in-Binary-Matrix/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1100~1199/1105.Filling-Bookcase-Shelves/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -106,5 +106,5 @@ func maxNumEdgesToRemove(n int, edges [][]int) int {
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1500~1599/1573.Number-of-Ways-to-Split-a-String/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1631.Path-With-Minimum-Effort/">下一页➡️</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1614.Maximum-Nesting-Depth-of-the-Parentheses/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -0,0 +1,109 @@
|
||||
# [1614. Maximum Nesting Depth of the Parentheses](https://leetcode.com/problems/maximum-nesting-depth-of-the-parentheses/)
|
||||
|
||||
## 题目
|
||||
|
||||
A string is a **valid parentheses string** (denoted **VPS**) if it meets one of the following:
|
||||
|
||||
- It is an empty string `""`, or a single character not equal to `"("` or `")"`,
|
||||
- It can be written as `AB` (`A` concatenated with `B`), where `A` and `B` are **VPS**'s, or
|
||||
- It can be written as `(A)`, where `A` is a **VPS**.
|
||||
|
||||
We can similarly define the **nesting depth** `depth(S)` of any VPS `S` as follows:
|
||||
|
||||
- `depth("") = 0`
|
||||
- `depth(C) = 0`, where `C` is a string with a single character not equal to `"("` or `")"`.
|
||||
- `depth(A + B) = max(depth(A), depth(B))`, where `A` and `B` are **VPS**'s.
|
||||
- `depth("(" + A + ")") = 1 + depth(A)`, where `A` is a **VPS**.
|
||||
|
||||
For example, `""`, `"()()"`, and `"()(()())"` are **VPS**'s (with nesting depths 0, 1, and 2), and `")("` and `"(()"` are not **VPS**'s.
|
||||
|
||||
Given a **VPS** represented as string `s`, return *the **nesting depth** of* `s`.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: s = "(1+(2*3)+((8)/4))+1"
|
||||
Output: 3
|
||||
Explanation: Digit 8 is inside of 3 nested parentheses in the string.
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: s = "(1)+((2))+(((3)))"
|
||||
Output: 3
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```
|
||||
Input: s = "1+(2*3)/(2-1)"
|
||||
Output: 1
|
||||
```
|
||||
|
||||
**Example 4:**
|
||||
|
||||
```
|
||||
Input: s = "1"
|
||||
Output: 0
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `1 <= s.length <= 100`
|
||||
- `s` consists of digits `0-9` and characters `'+'`, `'-'`, `'*'`, `'/'`, `'('`, and `')'`.
|
||||
- It is guaranteed that parentheses expression `s` is a **VPS**.
|
||||
|
||||
## 题目大意
|
||||
|
||||
如果字符串满足以下条件之一,则可以称之为 有效括号字符串(valid parentheses string,可以简写为 VPS):
|
||||
|
||||
- 字符串是一个空字符串 "",或者是一个不为 "(" 或 ")" 的单字符。
|
||||
- 字符串可以写为 AB(A 与 B 字符串连接),其中 A 和 B 都是 有效括号字符串 。
|
||||
- 字符串可以写为 (A),其中 A 是一个 有效括号字符串 。
|
||||
|
||||
类似地,可以定义任何有效括号字符串 S 的 嵌套深度 depth(S):
|
||||
|
||||
- depth("") = 0
|
||||
- depth(C) = 0,其中 C 是单个字符的字符串,且该字符不是 "(" 或者 ")"
|
||||
- depth(A + B) = max(depth(A), depth(B)),其中 A 和 B 都是 有效括号字符串
|
||||
- depth("(" + A + ")") = 1 + depth(A),其中 A 是一个 有效括号字符串
|
||||
|
||||
例如:""、"()()"、"()(()())" 都是 有效括号字符串(嵌套深度分别为 0、1、2),而 ")(" 、"(()" 都不是 有效括号字符串 。给你一个 有效括号字符串 s,返回该字符串的 s 嵌套深度 。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 简单题。求一个括号字符串的嵌套深度。题目给的括号字符串都是有效的,所以不需要考虑非法的情况。扫描一遍括号字符串,遇到 `(` 可以无脑 ++,并动态维护最大值,遇到 `)` 可以无脑 - - 。最后输出最大值即可。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
func maxDepth(s string) int {
|
||||
res, cur := 0, 0
|
||||
for _, c := range s {
|
||||
if c == '(' {
|
||||
cur++
|
||||
res = max(res, cur)
|
||||
} else if c == ')' {
|
||||
cur--
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1500~1599/1579.Remove-Max-Number-of-Edges-to-Keep-Graph-Fully-Traversable/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1619.Mean-of-Array-After-Removing-Some-Elements/">下一页➡️</a></p>
|
||||
</div>
|
@ -0,0 +1,81 @@
|
||||
# [1619. Mean of Array After Removing Some Elements](https://leetcode.com/problems/mean-of-array-after-removing-some-elements/)
|
||||
|
||||
## 题目
|
||||
|
||||
Given an integer array `arr`, return *the mean of the remaining integers after removing the smallest `5%` and the largest `5%` of the elements.*
|
||||
|
||||
Answers within `10-5` of the **actual answer** will be considered accepted.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: arr = [1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3]
|
||||
Output: 2.00000
|
||||
Explanation: After erasing the minimum and the maximum values of this array, all elements are equal to 2, so the mean is 2.
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: arr = [6,2,7,5,1,2,0,3,10,2,5,0,5,5,0,8,7,6,8,0]
|
||||
Output: 4.00000
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```
|
||||
Input: arr = [6,0,7,0,7,5,7,8,3,4,0,7,8,1,6,8,1,1,2,4,8,1,9,5,4,3,8,5,10,8,6,6,1,0,6,10,8,2,3,4]
|
||||
Output: 4.77778
|
||||
```
|
||||
|
||||
**Example 4:**
|
||||
|
||||
```
|
||||
Input: arr = [9,7,8,7,7,8,4,4,6,8,8,7,6,8,8,9,2,6,0,0,1,10,8,6,3,3,5,1,10,9,0,7,10,0,10,4,1,10,6,9,3,6,0,0,2,7,0,6,7,2,9,7,7,3,0,1,6,1,10,3]
|
||||
Output: 5.27778
|
||||
```
|
||||
|
||||
**Example 5:**
|
||||
|
||||
```
|
||||
Input: arr = [4,8,4,10,0,7,1,3,7,8,8,3,4,1,6,2,1,1,8,0,9,8,0,3,9,10,3,10,1,10,7,3,2,1,4,9,10,7,6,4,0,8,5,1,2,1,6,2,5,0,7,10,9,10,3,7,10,5,8,5,7,6,7,6,10,9,5,10,5,5,7,2,10,7,7,8,2,0,1,1]
|
||||
Output: 5.29167
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `20 <= arr.length <= 1000`
|
||||
- `arr.length` **is a multiple** of `20`.
|
||||
- `0 <= arr[i] <= 10^5`
|
||||
|
||||
## 题目大意
|
||||
|
||||
给你一个整数数组 `arr` ,请你删除最小 `5%` 的数字和最大 `5%` 的数字后,剩余数字的平均值。与 **标准答案** 误差在 `10-5` 的结果都被视为正确结果。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 简单题。先将数组排序,然后累加中间 90% 的元素,最后计算平均值。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
import "sort"
|
||||
|
||||
func trimMean(arr []int) float64 {
|
||||
sort.Ints(arr)
|
||||
n, sum := len(arr), 0
|
||||
for i := n / 20; i < n-(n/20); i++ {
|
||||
sum += arr[i]
|
||||
}
|
||||
return float64(sum) / float64((n - (n / 10)))
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1614.Maximum-Nesting-Depth-of-the-Parentheses/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1624.Largest-Substring-Between-Two-Equal-Characters/">下一页➡️</a></p>
|
||||
</div>
|
@ -0,0 +1,80 @@
|
||||
# [1624. Largest Substring Between Two Equal Characters](https://leetcode.com/problems/largest-substring-between-two-equal-characters/)
|
||||
|
||||
## 题目
|
||||
|
||||
Given a string `s`, return *the length of the longest substring between two equal characters, excluding the two characters.* If there is no such substring return `-1`.
|
||||
|
||||
A **substring** is a contiguous sequence of characters within a string.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: s = "aa"
|
||||
Output: 0
|
||||
Explanation: The optimal substring here is an empty substring between the two 'a's.
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: s = "abca"
|
||||
Output: 2
|
||||
Explanation: The optimal substring here is "bc".
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```
|
||||
Input: s = "cbzxy"
|
||||
Output: -1
|
||||
Explanation: There are no characters that appear twice in s.
|
||||
```
|
||||
|
||||
**Example 4:**
|
||||
|
||||
```
|
||||
Input: s = "cabbac"
|
||||
Output: 4
|
||||
Explanation: The optimal substring here is "abba". Other non-optimal substrings include "bb" and "".
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `1 <= s.length <= 300`
|
||||
- `s` contains only lowercase English letters.
|
||||
|
||||
## 题目大意
|
||||
|
||||
给你一个字符串 s,请你返回 两个相同字符之间的最长子字符串的长度 ,计算长度时不含这两个字符。如果不存在这样的子字符串,返回 -1 。子字符串 是字符串中的一个连续字符序列。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 简单题。取每个字符,扫描一次字符串,如果在字符串中还能找到相同的字符,则返回最末尾的那个字符,计算这两个字符之间的距离。取最末尾的字符是为了让两个相同的字符距离最长。扫描字符串过程中动态维护最长长度。如果字符串中不存在 2 个相同的字符,则返回 -1 。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
import "strings"
|
||||
|
||||
func maxLengthBetweenEqualCharacters(s string) int {
|
||||
res := -1
|
||||
for k, v := range s {
|
||||
tmp := strings.LastIndex(s, string(v))
|
||||
if tmp > 0 {
|
||||
if res < tmp-k-1 {
|
||||
res = tmp - k - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1619.Mean-of-Array-After-Removing-Some-Elements/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1629.Slowest-Key/">下一页➡️</a></p>
|
||||
</div>
|
90
website/content/ChapterFour/1600~1699/1629.Slowest-Key.md
Normal file
90
website/content/ChapterFour/1600~1699/1629.Slowest-Key.md
Normal file
@ -0,0 +1,90 @@
|
||||
# [1629. Slowest Key](https://leetcode.com/problems/slowest-key/)
|
||||
|
||||
|
||||
## 题目
|
||||
|
||||
A newly designed keypad was tested, where a tester pressed a sequence of `n` keys, one at a time.
|
||||
|
||||
You are given a string `keysPressed` of length `n`, where `keysPressed[i]` was the `ith` key pressed in the testing sequence, and a sorted list `releaseTimes`, where `releaseTimes[i]` was the time the `ith` key was released. Both arrays are **0-indexed**. The `0th` key was pressed at the time `0`, and every subsequent key was pressed at the **exact** time the previous key was released.
|
||||
|
||||
The tester wants to know the key of the keypress that had the **longest duration**. The `ith` keypress had a **duration** of `releaseTimes[i] - releaseTimes[i - 1]`, and the `0th` keypress had a duration of `releaseTimes[0]`.
|
||||
|
||||
Note that the same key could have been pressed multiple times during the test, and these multiple presses of the same key **may not** have had the same **duration**.
|
||||
|
||||
*Return the key of the keypress that had the **longest duration**. If there are multiple such keypresses, return the lexicographically largest key of the keypresses.*
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: releaseTimes = [9,29,49,50], keysPressed = "cbcd"
|
||||
Output: "c"
|
||||
Explanation: The keypresses were as follows:
|
||||
Keypress for 'c' had a duration of 9 (pressed at time 0 and released at time 9).
|
||||
Keypress for 'b' had a duration of 29 - 9 = 20 (pressed at time 9 right after the release of the previous character and released at time 29).
|
||||
Keypress for 'c' had a duration of 49 - 29 = 20 (pressed at time 29 right after the release of the previous character and released at time 49).
|
||||
Keypress for 'd' had a duration of 50 - 49 = 1 (pressed at time 49 right after the release of the previous character and released at time 50).
|
||||
The longest of these was the keypress for 'b' and the second keypress for 'c', both with duration 20.
|
||||
'c' is lexicographically larger than 'b', so the answer is 'c'.
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: releaseTimes = [12,23,36,46,62], keysPressed = "spuda"
|
||||
Output: "a"
|
||||
Explanation: The keypresses were as follows:
|
||||
Keypress for 's' had a duration of 12.
|
||||
Keypress for 'p' had a duration of 23 - 12 = 11.
|
||||
Keypress for 'u' had a duration of 36 - 23 = 13.
|
||||
Keypress for 'd' had a duration of 46 - 36 = 10.
|
||||
Keypress for 'a' had a duration of 62 - 46 = 16.
|
||||
The longest of these was the keypress for 'a' with duration 16.
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `releaseTimes.length == n`
|
||||
- `keysPressed.length == n`
|
||||
- `2 <= n <= 1000`
|
||||
- `1 <= releaseTimes[i] <= 109`
|
||||
- `releaseTimes[i] < releaseTimes[i+1]`
|
||||
- `keysPressed` contains only lowercase English letters.
|
||||
|
||||
## 题目大意
|
||||
|
||||
LeetCode 设计了一款新式键盘,正在测试其可用性。测试人员将会点击一系列键(总计 n 个),每次一个。
|
||||
|
||||
给你一个长度为 n 的字符串 keysPressed ,其中 keysPressed[i] 表示测试序列中第 i 个被按下的键。releaseTimes 是一个升序排列的列表,其中 releaseTimes[i] 表示松开第 i 个键的时间。字符串和数组的 下标都从 0 开始 。第 0 个键在时间为 0 时被按下,接下来每个键都 恰好 在前一个键松开时被按下。测试人员想要找出按键 持续时间最长 的键。第 i 次按键的持续时间为 releaseTimes[i] - releaseTimes[i - 1] ,第 0 次按键的持续时间为 releaseTimes[0] 。
|
||||
|
||||
注意,测试期间,同一个键可以在不同时刻被多次按下,而每次的持续时间都可能不同。请返回按键 持续时间最长 的键,如果有多个这样的键,则返回 按字母顺序排列最大 的那个键。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 题干很长,不过还是简单题。循环扫描一遍数组,计算出每个按键的持续时间。动态更新按键最长时间的键。如果持续时间最长的有多个键,需要返回字母序最大的那一个键。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
func slowestKey(releaseTimes []int, keysPressed string) byte {
|
||||
longestDuration, key := releaseTimes[0], keysPressed[0]
|
||||
for i := 1; i < len(releaseTimes); i++ {
|
||||
duration := releaseTimes[i] - releaseTimes[i-1]
|
||||
if duration > longestDuration {
|
||||
longestDuration = duration
|
||||
key = keysPressed[i]
|
||||
} else if duration == longestDuration && keysPressed[i] > key {
|
||||
key = keysPressed[i]
|
||||
}
|
||||
}
|
||||
return key
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1624.Largest-Substring-Between-Two-Equal-Characters/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1631.Path-With-Minimum-Effort/">下一页➡️</a></p>
|
||||
</div>
|
@ -172,6 +172,6 @@ type edge struct {
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1500~1599/1579.Remove-Max-Number-of-Edges-to-Keep-Graph-Fully-Traversable/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation/">下一页➡️</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1629.Slowest-Key/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1636.Sort-Array-by-Increasing-Frequency/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -0,0 +1,73 @@
|
||||
# [1636. Sort Array by Increasing Frequency](https://leetcode.com/problems/sort-array-by-increasing-frequency/)
|
||||
|
||||
|
||||
## 题目
|
||||
|
||||
Given an array of integers `nums`, sort the array in **increasing** order based on the frequency of the values. If multiple values have the same frequency, sort them in **decreasing** order.
|
||||
|
||||
Return the *sorted array*.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: nums = [1,1,2,2,2,3]
|
||||
Output: [3,1,1,2,2,2]
|
||||
Explanation: '3' has a frequency of 1, '1' has a frequency of 2, and '2' has a frequency of 3.
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: nums = [2,3,1,3,2]
|
||||
Output: [1,3,3,2,2]
|
||||
Explanation: '2' and '3' both have a frequency of 2, so they are sorted in decreasing order.
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```
|
||||
Input: nums = [-1,1,-6,4,5,-6,1,4,1]
|
||||
Output: [5,-1,4,4,-6,-6,1,1,1]
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `1 <= nums.length <= 100`
|
||||
- `100 <= nums[i] <= 100`
|
||||
|
||||
## 题目大意
|
||||
|
||||
给你一个整数数组 `nums` ,请你将数组按照每个值的频率 **升序** 排序。如果有多个值的频率相同,请你按照数值本身将它们 **降序** 排序。请你返回排序后的数组。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 简单题。先统计每个值的频率,然后按照频率从小到大排序,相同频率的按照值的大小,从大到小排序。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
import "sort"
|
||||
|
||||
func frequencySort(nums []int) []int {
|
||||
freq := map[int]int{}
|
||||
for _, v := range nums {
|
||||
freq[v]++
|
||||
}
|
||||
sort.Slice(nums, func(i, j int) bool {
|
||||
if freq[nums[i]] == freq[nums[j]] {
|
||||
return nums[j] < nums[i]
|
||||
}
|
||||
return freq[nums[i]] < freq[nums[j]]
|
||||
})
|
||||
return nums
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1631.Path-With-Minimum-Effort/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation/">下一页➡️</a></p>
|
||||
</div>
|
@ -97,6 +97,6 @@ func canFormArray(arr []int, pieces [][]int) bool {
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1631.Path-With-Minimum-Effort/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1636.Sort-Array-by-Increasing-Frequency/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1641.Count-Sorted-Vowel-Strings/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -109,6 +109,10 @@ func max(a, b int) int {
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1695.Maximum-Erasure-Value/">⬅️上一页</a></p>
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1695.Maximum-Erasure-Value/">⬅️上一页</a></p>
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1700~1799/1704.Determine-if-String-Halves-Are-Alike/">下一页➡️</a></p>
|
||||
</div>
|
||||
|
@ -0,0 +1,80 @@
|
||||
# [1704. Determine if String Halves Are Alike](https://leetcode.com/problems/determine-if-string-halves-are-alike/)
|
||||
|
||||
## 题目
|
||||
|
||||
You are given a string `s` of even length. Split this string into two halves of equal lengths, and let `a` be the first half and `b` be the second half.
|
||||
|
||||
Two strings are **alike** if they have the same number of vowels (`'a'`, `'e'`, `'i'`, `'o'`, `'u'`, `'A'`, `'E'`, `'I'`, `'O'`, `'U'`). Notice that `s` contains uppercase and lowercase letters.
|
||||
|
||||
Return `true` *if* `a` *and* `b` *are **alike***. Otherwise, return `false`.
|
||||
|
||||
**Example 1:**
|
||||
|
||||
```
|
||||
Input: s = "book"
|
||||
Output: true
|
||||
Explanation: a = "bo" and b = "ok". a has 1 vowel and b has 1 vowel. Therefore, they are alike.
|
||||
```
|
||||
|
||||
**Example 2:**
|
||||
|
||||
```
|
||||
Input: s = "textbook"
|
||||
Output: false
|
||||
Explanation: a = "text" and b = "book". a has 1 vowel whereas b has 2. Therefore, they are not alike.
|
||||
Notice that the vowel o is counted twice.
|
||||
```
|
||||
|
||||
**Example 3:**
|
||||
|
||||
```
|
||||
Input: s = "MerryChristmas"
|
||||
Output: false
|
||||
```
|
||||
|
||||
**Example 4:**
|
||||
|
||||
```
|
||||
Input: s = "AbCdEfGh"
|
||||
Output: true
|
||||
```
|
||||
|
||||
**Constraints:**
|
||||
|
||||
- `2 <= s.length <= 1000`
|
||||
- `s.length` is even.
|
||||
- `s` consists of **uppercase and lowercase** letters.
|
||||
|
||||
## 题目大意
|
||||
|
||||
给你一个偶数长度的字符串 s 。将其拆分成长度相同的两半,前一半为 a ,后一半为 b 。两个字符串 相似 的前提是它们都含有相同数目的元音('a','e','i','o','u','A','E','I','O','U')。注意,s 可能同时含有大写和小写字母。如果 a 和 b 相似,返回 true ;否则,返回 false 。
|
||||
|
||||
## 解题思路
|
||||
|
||||
- 简单题。依题意,分别统计前半段元音字母的个数和后半段元音字母的个数,个数相同则输出 true,不同就输出 false。
|
||||
|
||||
## 代码
|
||||
|
||||
```go
|
||||
package leetcode
|
||||
|
||||
func halvesAreAlike(s string) bool {
|
||||
return numVowels(s[len(s)/2:]) == numVowels(s[:len(s)/2])
|
||||
}
|
||||
|
||||
func numVowels(x string) int {
|
||||
res := 0
|
||||
for _, c := range x {
|
||||
switch c {
|
||||
case 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U':
|
||||
res++
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
----------------------------------------------
|
||||
<p><a href="https://books.halfrost.com/leetcode/ChapterFour/1600~1699/1696.Jump-Game-VI/">⬅️上一页</a></p>
|
||||
|
4
website/content/ChapterFour/1700~1799/_index.md
Normal file
4
website/content/ChapterFour/1700~1799/_index.md
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
bookCollapseSection: true
|
||||
weight: 20
|
||||
---
|
@ -106,7 +106,7 @@ weight: 1
|
||||
|0922|Sort Array By Parity II|[Go]({{< relref "/ChapterFour/0900~0999/0922.Sort-Array-By-Parity-II.md" >}})|Easy| O(n)| O(1)||70.5%|
|
||||
|0969|Pancake Sorting|[Go]({{< relref "/ChapterFour/0900~0999/0969.Pancake-Sorting.md" >}})|Medium| O(n)| O(1)|❤️|68.6%|
|
||||
|0977|Squares of a Sorted Array|[Go]({{< relref "/ChapterFour/0900~0999/0977.Squares-of-a-Sorted-Array.md" >}})|Easy| O(n)| O(1)||72.1%|
|
||||
|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0900~0999/0978.Longest-Turbulent-Subarray.md" >}})|Medium||||46.6%|
|
||||
|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0900~0999/0978.Longest-Turbulent-Subarray.md" >}})|Medium||||46.7%|
|
||||
|0985|Sum of Even Numbers After Queries|[Go]({{< relref "/ChapterFour/0900~0999/0985.Sum-of-Even-Numbers-After-Queries.md" >}})|Easy||||60.7%|
|
||||
|0989|Add to Array-Form of Integer|[Go]({{< relref "/ChapterFour/0900~0999/0989.Add-to-Array-Form-of-Integer.md" >}})|Easy||||44.8%|
|
||||
|0999|Available Captures for Rook|[Go]({{< relref "/ChapterFour/0900~0999/0999.Available-Captures-for-Rook.md" >}})|Easy||||67.7%|
|
||||
@ -125,7 +125,7 @@ weight: 1
|
||||
|1170|Compare Strings by Frequency of the Smallest Character|[Go]({{< relref "/ChapterFour/1100~1199/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}})|Medium||||59.6%|
|
||||
|1184|Distance Between Bus Stops|[Go]({{< relref "/ChapterFour/1100~1199/1184.Distance-Between-Bus-Stops.md" >}})|Easy||||54.1%|
|
||||
|1185|Day of the Week|[Go]({{< relref "/ChapterFour/1100~1199/1185.Day-of-the-Week.md" >}})|Easy||||61.6%|
|
||||
|1200|Minimum Absolute Difference|[Go]({{< relref "/ChapterFour/1200~1299/1200.Minimum-Absolute-Difference.md" >}})|Easy||||66.9%|
|
||||
|1200|Minimum Absolute Difference|[Go]({{< relref "/ChapterFour/1200~1299/1200.Minimum-Absolute-Difference.md" >}})|Easy||||67.0%|
|
||||
|1202|Smallest String With Swaps|[Go]({{< relref "/ChapterFour/1200~1299/1202.Smallest-String-With-Swaps.md" >}})|Medium||||48.7%|
|
||||
|1208|Get Equal Substrings Within Budget|[Go]({{< relref "/ChapterFour/1200~1299/1208.Get-Equal-Substrings-Within-Budget.md" >}})|Medium||||43.9%|
|
||||
|1217|Minimum Cost to Move Chips to The Same Position|[Go]({{< relref "/ChapterFour/1200~1299/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}})|Easy||||71.2%|
|
||||
@ -151,10 +151,13 @@ weight: 1
|
||||
|1480|Running Sum of 1d Array|[Go]({{< relref "/ChapterFour/1400~1499/1480.Running-Sum-of-1d-Array.md" >}})|Easy||||89.2%|
|
||||
|1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1500~1599/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.7%|
|
||||
|1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1500~1599/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.1%|
|
||||
|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||60.2%|
|
||||
|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1600~1699/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.5%|
|
||||
|1619|Mean of Array After Removing Some Elements|[Go]({{< relref "/ChapterFour/1600~1699/1619.Mean-of-Array-After-Removing-Some-Elements.md" >}})|Easy||||65.2%|
|
||||
|1629|Slowest Key|[Go]({{< relref "/ChapterFour/1600~1699/1629.Slowest-Key.md" >}})|Easy||||59.2%|
|
||||
|1636|Sort Array by Increasing Frequency|[Go]({{< relref "/ChapterFour/1600~1699/1636.Sort-Array-by-Increasing-Frequency.md" >}})|Easy||||66.8%|
|
||||
|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||60.1%|
|
||||
|1646|Get Maximum in Generated Array|[Go]({{< relref "/ChapterFour/1600~1699/1646.Get-Maximum-in-Generated-Array.md" >}})|Easy||||53.4%|
|
||||
|1652|Defuse the Bomb|[Go]({{< relref "/ChapterFour/1600~1699/1652.Defuse-the-Bomb.md" >}})|Easy||||63.0%|
|
||||
|1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1600~1699/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.2%|
|
||||
|1656|Design an Ordered Stream|[Go]({{< relref "/ChapterFour/1600~1699/1656.Design-an-Ordered-Stream.md" >}})|Easy||||82.3%|
|
||||
|1672|Richest Customer Wealth|[Go]({{< relref "/ChapterFour/1600~1699/1672.Richest-Customer-Wealth.md" >}})|Easy||||88.4%|
|
||||
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|
|
||||
|
||||
|
@ -101,7 +101,7 @@ func updateMatrix_BFS(matrix [][]int) [][]int {
|
||||
| No. | Title | Solution | Difficulty | TimeComplexity | SpaceComplexity |Favorite| Acceptance |
|
||||
|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: |
|
||||
|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0001~0099/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||49.0%|
|
||||
|0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0001~0099/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||65.1%|
|
||||
|0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0001~0099/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||65.2%|
|
||||
|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0001~0099/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|46.4%|
|
||||
|0039|Combination Sum|[Go]({{< relref "/ChapterFour/0001~0099/0039.Combination-Sum.md" >}})|Medium| O(n log n)| O(n)||59.1%|
|
||||
|0040|Combination Sum II|[Go]({{< relref "/ChapterFour/0001~0099/0040.Combination-Sum-II.md" >}})|Medium| O(n log n)| O(n)||50.0%|
|
||||
|
@ -144,7 +144,7 @@ func peakIndexInMountainArray(A []int) int {
|
||||
|0154|Find Minimum in Rotated Sorted Array II|[Go]({{< relref "/ChapterFour/0100~0199/0154.Find-Minimum-in-Rotated-Sorted-Array-II.md" >}})|Hard||||42.0%|
|
||||
|0162|Find Peak Element|[Go]({{< relref "/ChapterFour/0100~0199/0162.Find-Peak-Element.md" >}})|Medium||||43.9%|
|
||||
|0167|Two Sum II - Input array is sorted|[Go]({{< relref "/ChapterFour/0100~0199/0167.Two-Sum-II---Input-array-is-sorted.md" >}})|Easy| O(n)| O(1)||55.6%|
|
||||
|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0100~0199/0174.Dungeon-Game.md" >}})|Hard||||33.2%|
|
||||
|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0100~0199/0174.Dungeon-Game.md" >}})|Hard||||33.3%|
|
||||
|0209|Minimum Size Subarray Sum|[Go]({{< relref "/ChapterFour/0200~0299/0209.Minimum-Size-Subarray-Sum.md" >}})|Medium| O(n)| O(1)||39.4%|
|
||||
|0222|Count Complete Tree Nodes|[Go]({{< relref "/ChapterFour/0200~0299/0222.Count-Complete-Tree-Nodes.md" >}})|Medium| O(n)| O(1)||49.1%|
|
||||
|0230|Kth Smallest Element in a BST|[Go]({{< relref "/ChapterFour/0200~0299/0230.Kth-Smallest-Element-in-a-BST.md" >}})|Medium| O(n)| O(1)||62.5%|
|
||||
@ -162,7 +162,7 @@ func peakIndexInMountainArray(A []int) int {
|
||||
|0392|Is Subsequence|[Go]({{< relref "/ChapterFour/0300~0399/0392.Is-Subsequence.md" >}})|Easy| O(n)| O(1)||49.5%|
|
||||
|0410|Split Array Largest Sum|[Go]({{< relref "/ChapterFour/0400~0499/0410.Split-Array-Largest-Sum.md" >}})|Hard||||46.3%|
|
||||
|0436|Find Right Interval|[Go]({{< relref "/ChapterFour/0400~0499/0436.Find-Right-Interval.md" >}})|Medium||||48.5%|
|
||||
|0441|Arranging Coins|[Go]({{< relref "/ChapterFour/0400~0499/0441.Arranging-Coins.md" >}})|Easy||||42.4%|
|
||||
|0441|Arranging Coins|[Go]({{< relref "/ChapterFour/0400~0499/0441.Arranging-Coins.md" >}})|Easy||||42.3%|
|
||||
|0454|4Sum II|[Go]({{< relref "/ChapterFour/0400~0499/0454.4Sum-II.md" >}})|Medium| O(n^2)| O(n) ||54.6%|
|
||||
|0475|Heaters|[Go]({{< relref "/ChapterFour/0400~0499/0475.Heaters.md" >}})|Medium||||33.6%|
|
||||
|0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0400~0499/0483.Smallest-Good-Base.md" >}})|Hard||||36.2%|
|
||||
@ -181,10 +181,10 @@ func peakIndexInMountainArray(A []int) int {
|
||||
|0793|Preimage Size of Factorial Zeroes Function|[Go]({{< relref "/ChapterFour/0700~0799/0793.Preimage-Size-of-Factorial-Zeroes-Function.md" >}})|Hard||||40.7%|
|
||||
|0852|Peak Index in a Mountain Array|[Go]({{< relref "/ChapterFour/0800~0899/0852.Peak-Index-in-a-Mountain-Array.md" >}})|Easy||||71.7%|
|
||||
|0862|Shortest Subarray with Sum at Least K|[Go]({{< relref "/ChapterFour/0800~0899/0862.Shortest-Subarray-with-Sum-at-Least-K.md" >}})|Hard||||25.2%|
|
||||
|0875|Koko Eating Bananas|[Go]({{< relref "/ChapterFour/0800~0899/0875.Koko-Eating-Bananas.md" >}})|Medium||||53.4%|
|
||||
|0875|Koko Eating Bananas|[Go]({{< relref "/ChapterFour/0800~0899/0875.Koko-Eating-Bananas.md" >}})|Medium||||53.5%|
|
||||
|0878|Nth Magical Number|[Go]({{< relref "/ChapterFour/0800~0899/0878.Nth-Magical-Number.md" >}})|Hard||||28.8%|
|
||||
|0887|Super Egg Drop|[Go]({{< relref "/ChapterFour/0800~0899/0887.Super-Egg-Drop.md" >}})|Hard||||27.1%|
|
||||
|0911|Online Election|[Go]({{< relref "/ChapterFour/0900~0999/0911.Online-Election.md" >}})|Medium||||51.3%|
|
||||
|0911|Online Election|[Go]({{< relref "/ChapterFour/0900~0999/0911.Online-Election.md" >}})|Medium||||51.2%|
|
||||
|0927|Three Equal Parts|[Go]({{< relref "/ChapterFour/0900~0999/0927.Three-Equal-Parts.md" >}})|Hard||||34.6%|
|
||||
|0981|Time Based Key-Value Store|[Go]({{< relref "/ChapterFour/0900~0999/0981.Time-Based-Key-Value-Store.md" >}})|Medium||||54.1%|
|
||||
|1011|Capacity To Ship Packages Within D Days|[Go]({{< relref "/ChapterFour/1000~1099/1011.Capacity-To-Ship-Packages-Within-D-Days.md" >}})|Medium||||59.7%|
|
||||
@ -192,7 +192,7 @@ func peakIndexInMountainArray(A []int) int {
|
||||
|1157|Online Majority Element In Subarray|[Go]({{< relref "/ChapterFour/1100~1199/1157.Online-Majority-Element-In-Subarray.md" >}})|Hard||||39.6%|
|
||||
|1170|Compare Strings by Frequency of the Smallest Character|[Go]({{< relref "/ChapterFour/1100~1199/1170.Compare-Strings-by-Frequency-of-the-Smallest-Character.md" >}})|Medium||||59.6%|
|
||||
|1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1200~1299/1201.Ugly-Number-III.md" >}})|Medium||||26.4%|
|
||||
|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1200~1299/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.3%|
|
||||
|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1200~1299/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.4%|
|
||||
|1283|Find the Smallest Divisor Given a Threshold|[Go]({{< relref "/ChapterFour/1200~1299/1283.Find-the-Smallest-Divisor-Given-a-Threshold.md" >}})|Medium||||49.4%|
|
||||
|1300|Sum of Mutated Array Closest to Target|[Go]({{< relref "/ChapterFour/1300~1399/1300.Sum-of-Mutated-Array-Closest-to-Target.md" >}})|Medium||||43.2%|
|
||||
|1631|Path With Minimum Effort|[Go]({{< relref "/ChapterFour/1600~1699/1631.Path-With-Minimum-Effort.md" >}})|Medium||||50.1%|
|
||||
|
@ -61,7 +61,7 @@ X & ~X = 0
|
||||
|0371|Sum of Two Integers|[Go]({{< relref "/ChapterFour/0300~0399/0371.Sum-of-Two-Integers.md" >}})|Medium| O(n)| O(1)||50.6%|
|
||||
|0389|Find the Difference|[Go]({{< relref "/ChapterFour/0300~0399/0389.Find-the-Difference.md" >}})|Easy| O(n)| O(1)||57.8%|
|
||||
|0393|UTF-8 Validation|[Go]({{< relref "/ChapterFour/0300~0399/0393.UTF-8-Validation.md" >}})|Medium| O(n)| O(1)||38.0%|
|
||||
|0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0300~0399/0397.Integer-Replacement.md" >}})|Medium| O(n)| O(1)||33.4%|
|
||||
|0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0300~0399/0397.Integer-Replacement.md" >}})|Medium| O(n)| O(1)||33.5%|
|
||||
|0401|Binary Watch|[Go]({{< relref "/ChapterFour/0400~0499/0401.Binary-Watch.md" >}})|Easy| O(1)| O(1)||48.4%|
|
||||
|0405|Convert a Number to Hexadecimal|[Go]({{< relref "/ChapterFour/0400~0499/0405.Convert-a-Number-to-Hexadecimal.md" >}})|Easy| O(n)| O(1)||44.4%|
|
||||
|0421|Maximum XOR of Two Numbers in an Array|[Go]({{< relref "/ChapterFour/0400~0499/0421.Maximum-XOR-of-Two-Numbers-in-an-Array.md" >}})|Medium| O(n)| O(1)|❤️|54.1%|
|
||||
|
@ -18,7 +18,7 @@ weight: 10
|
||||
|0127|Word Ladder|[Go]({{< relref "/ChapterFour/0100~0199/0127.Word-Ladder.md" >}})|Hard| O(n)| O(n)||31.7%|
|
||||
|0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0100~0199/0130.Surrounded-Regions.md" >}})|Medium||||29.3%|
|
||||
|0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0100~0199/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||56.3%|
|
||||
|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200~0299/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||48.9%|
|
||||
|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200~0299/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||49.0%|
|
||||
|0207|Course Schedule|[Go]({{< relref "/ChapterFour/0200~0299/0207.Course-Schedule.md" >}})|Medium| O(n^2)| O(n^2)||44.3%|
|
||||
|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0200~0299/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.5%|
|
||||
|0513|Find Bottom Left Tree Value|[Go]({{< relref "/ChapterFour/0500~0599/0513.Find-Bottom-Left-Tree-Value.md" >}})|Medium||||62.5%|
|
||||
@ -31,9 +31,10 @@ weight: 10
|
||||
|0864|Shortest Path to Get All Keys|[Go]({{< relref "/ChapterFour/0800~0899/0864.Shortest-Path-to-Get-All-Keys.md" >}})|Hard||||41.9%|
|
||||
|0987|Vertical Order Traversal of a Binary Tree|[Go]({{< relref "/ChapterFour/0900~0999/0987.Vertical-Order-Traversal-of-a-Binary-Tree.md" >}})|Hard||||38.7%|
|
||||
|0993|Cousins in Binary Tree|[Go]({{< relref "/ChapterFour/0900~0999/0993.Cousins-in-Binary-Tree.md" >}})|Easy| O(n)| O(1)||52.3%|
|
||||
|1091|Shortest Path in Binary Matrix|[Go]({{< relref "/ChapterFour/1000~1099/1091.Shortest-Path-in-Binary-Matrix.md" >}})|Medium||||39.8%|
|
||||
|1306|Jump Game III|[Go]({{< relref "/ChapterFour/1300~1399/1306.Jump-Game-III.md" >}})|Medium||||62.6%|
|
||||
|1319|Number of Operations to Make Network Connected|[Go]({{< relref "/ChapterFour/1300~1399/1319.Number-of-Operations-to-Make-Network-Connected.md" >}})|Medium||||55.4%|
|
||||
|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1600~1699/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.1%|
|
||||
|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1600~1699/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.0%|
|
||||
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ weight: 9
|
||||
|0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0100~0199/0130.Surrounded-Regions.md" >}})|Medium||||29.3%|
|
||||
|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0100~0199/0131.Palindrome-Partitioning.md" >}})|Medium||||51.8%|
|
||||
|0199|Binary Tree Right Side View|[Go]({{< relref "/ChapterFour/0100~0199/0199.Binary-Tree-Right-Side-View.md" >}})|Medium| O(n)| O(1)||56.3%|
|
||||
|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200~0299/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||48.9%|
|
||||
|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200~0299/0200.Number-of-Islands.md" >}})|Medium| O(n^2)| O(n^2)||49.0%|
|
||||
|0207|Course Schedule|[Go]({{< relref "/ChapterFour/0200~0299/0207.Course-Schedule.md" >}})|Medium| O(n^2)| O(n^2)||44.3%|
|
||||
|0210|Course Schedule II|[Go]({{< relref "/ChapterFour/0200~0299/0210.Course-Schedule-II.md" >}})|Medium| O(n^2)| O(n^2)||42.5%|
|
||||
|0211|Design Add and Search Words Data Structure|[Go]({{< relref "/ChapterFour/0200~0299/0211.Design-Add-and-Search-Words-Data-Structure.md" >}})|Medium||||40.1%|
|
||||
@ -64,7 +64,7 @@ weight: 9
|
||||
|0863|All Nodes Distance K in Binary Tree|[Go]({{< relref "/ChapterFour/0800~0899/0863.All-Nodes-Distance-K-in-Binary-Tree.md" >}})|Medium||||57.8%|
|
||||
|0872|Leaf-Similar Trees|[Go]({{< relref "/ChapterFour/0800~0899/0872.Leaf-Similar-Trees.md" >}})|Easy||||64.6%|
|
||||
|0897|Increasing Order Search Tree|[Go]({{< relref "/ChapterFour/0800~0899/0897.Increasing-Order-Search-Tree.md" >}})|Easy||||74.5%|
|
||||
|0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0900~0999/0924.Minimize-Malware-Spread.md" >}})|Hard||||41.8%|
|
||||
|0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0900~0999/0924.Minimize-Malware-Spread.md" >}})|Hard||||41.9%|
|
||||
|0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0900~0999/0928.Minimize-Malware-Spread-II.md" >}})|Hard||||41.2%|
|
||||
|0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0900~0999/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium||||55.4%|
|
||||
|0959|Regions Cut By Slashes|[Go]({{< relref "/ChapterFour/0900~0999/0959.Regions-Cut-By-Slashes.md" >}})|Medium||||67.1%|
|
||||
|
@ -22,7 +22,7 @@ weight: 7
|
||||
|0121|Best Time to Buy and Sell Stock|[Go]({{< relref "/ChapterFour/0100~0199/0121.Best-Time-to-Buy-and-Sell-Stock.md" >}})|Easy| O(n)| O(1)||51.5%|
|
||||
|0131|Palindrome Partitioning|[Go]({{< relref "/ChapterFour/0100~0199/0131.Palindrome-Partitioning.md" >}})|Medium||||51.8%|
|
||||
|0152|Maximum Product Subarray|[Go]({{< relref "/ChapterFour/0100~0199/0152.Maximum-Product-Subarray.md" >}})|Medium| O(n)| O(1)||32.7%|
|
||||
|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0100~0199/0174.Dungeon-Game.md" >}})|Hard||||33.2%|
|
||||
|0174|Dungeon Game|[Go]({{< relref "/ChapterFour/0100~0199/0174.Dungeon-Game.md" >}})|Hard||||33.3%|
|
||||
|0198|House Robber|[Go]({{< relref "/ChapterFour/0100~0199/0198.House-Robber.md" >}})|Medium| O(n)| O(n)||42.8%|
|
||||
|0213|House Robber II|[Go]({{< relref "/ChapterFour/0200~0299/0213.House-Robber-II.md" >}})|Medium| O(n)| O(n)||37.5%|
|
||||
|0300|Longest Increasing Subsequence|[Go]({{< relref "/ChapterFour/0300~0399/0300.Longest-Increasing-Subsequence.md" >}})|Medium| O(n log n)| O(n)||43.9%|
|
||||
@ -48,21 +48,21 @@ weight: 7
|
||||
|0898|Bitwise ORs of Subarrays|[Go]({{< relref "/ChapterFour/0800~0899/0898.Bitwise-ORs-of-Subarrays.md" >}})|Medium||||34.1%|
|
||||
|0920|Number of Music Playlists|[Go]({{< relref "/ChapterFour/0900~0999/0920.Number-of-Music-Playlists.md" >}})|Hard||||47.8%|
|
||||
|0968|Binary Tree Cameras|[Go]({{< relref "/ChapterFour/0900~0999/0968.Binary-Tree-Cameras.md" >}})|Hard||||38.7%|
|
||||
|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0900~0999/0978.Longest-Turbulent-Subarray.md" >}})|Medium||||46.6%|
|
||||
|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0900~0999/0978.Longest-Turbulent-Subarray.md" >}})|Medium||||46.7%|
|
||||
|1025|Divisor Game|[Go]({{< relref "/ChapterFour/1000~1099/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.2%|
|
||||
|1049|Last Stone Weight II|[Go]({{< relref "/ChapterFour/1000~1099/1049.Last-Stone-Weight-II.md" >}})|Medium||||45.2%|
|
||||
|1074|Number of Submatrices That Sum to Target|[Go]({{< relref "/ChapterFour/1000~1099/1074.Number-of-Submatrices-That-Sum-to-Target.md" >}})|Hard||||61.7%|
|
||||
|1105|Filling Bookcase Shelves|[Go]({{< relref "/ChapterFour/1100~1199/1105.Filling-Bookcase-Shelves.md" >}})|Medium||||57.5%|
|
||||
|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1200~1299/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.3%|
|
||||
|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1200~1299/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.4%|
|
||||
|1423|Maximum Points You Can Obtain from Cards|[Go]({{< relref "/ChapterFour/1400~1499/1423.Maximum-Points-You-Can-Obtain-from-Cards.md" >}})|Medium||||46.6%|
|
||||
|1463|Cherry Pickup II|[Go]({{< relref "/ChapterFour/1400~1499/1463.Cherry-Pickup-II.md" >}})|Hard||||69.3%|
|
||||
|1641|Count Sorted Vowel Strings|[Go]({{< relref "/ChapterFour/1600~1699/1641.Count-Sorted-Vowel-Strings.md" >}})|Medium||||76.9%|
|
||||
|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1600~1699/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.1%|
|
||||
|1654|Minimum Jumps to Reach Home|[Go]({{< relref "/ChapterFour/1600~1699/1654.Minimum-Jumps-to-Reach-Home.md" >}})|Medium||||26.0%|
|
||||
|1655|Distribute Repeating Integers|[Go]({{< relref "/ChapterFour/1600~1699/1655.Distribute-Repeating-Integers.md" >}})|Hard||||40.3%|
|
||||
|1659|Maximize Grid Happiness|[Go]({{< relref "/ChapterFour/1600~1699/1659.Maximize-Grid-Happiness.md" >}})|Hard||||35.3%|
|
||||
|1664|Ways to Make a Fair Array|[Go]({{< relref "/ChapterFour/1600~1699/1664.Ways-to-Make-a-Fair-Array.md" >}})|Medium||||60.6%|
|
||||
|1664|Ways to Make a Fair Array|[Go]({{< relref "/ChapterFour/1600~1699/1664.Ways-to-Make-a-Fair-Array.md" >}})|Medium||||61.5%|
|
||||
|1690|Stone Game VII|[Go]({{< relref "/ChapterFour/1600~1699/1690.Stone-Game-VII.md" >}})|Medium||||47.6%|
|
||||
|1691|Maximum Height by Stacking Cuboids|[Go]({{< relref "/ChapterFour/1600~1699/1691.Maximum-Height-by-Stacking-Cuboids.md" >}})|Hard||||49.9%|
|
||||
|1691|Maximum Height by Stacking Cuboids|[Go]({{< relref "/ChapterFour/1600~1699/1691.Maximum-Height-by-Stacking-Cuboids.md" >}})|Hard||||50.0%|
|
||||
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|
|
||||
|
||||
|
||||
|
@ -12,8 +12,8 @@ weight: 13
|
||||
|0001|Two Sum|[Go]({{< relref "/ChapterFour/0001~0099/0001.Two-Sum.md" >}})|Easy| O(n)| O(n)||46.4%|
|
||||
|0003|Longest Substring Without Repeating Characters|[Go]({{< relref "/ChapterFour/0001~0099/0003.Longest-Substring-Without-Repeating-Characters.md" >}})|Medium| O(n)| O(1)|❤️|31.4%|
|
||||
|0018|4Sum|[Go]({{< relref "/ChapterFour/0001~0099/0018.4Sum.md" >}})|Medium| O(n^3)| O(n^2)|❤️|34.8%|
|
||||
|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0001~0099/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.1%|
|
||||
|0036|Valid Sudoku|[Go]({{< relref "/ChapterFour/0001~0099/0036.Valid-Sudoku.md" >}})|Medium| O(n^2)| O(n^2)||50.4%|
|
||||
|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0001~0099/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.2%|
|
||||
|0036|Valid Sudoku|[Go]({{< relref "/ChapterFour/0001~0099/0036.Valid-Sudoku.md" >}})|Medium| O(n^2)| O(n^2)||50.5%|
|
||||
|0037|Sudoku Solver|[Go]({{< relref "/ChapterFour/0001~0099/0037.Sudoku-Solver.md" >}})|Hard| O(n^2)| O(n^2)|❤️|46.4%|
|
||||
|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0001~0099/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||59.2%|
|
||||
|0076|Minimum Window Substring|[Go]({{< relref "/ChapterFour/0001~0099/0076.Minimum-Window-Substring.md" >}})|Hard| O(n)| O(n)|❤️|35.9%|
|
||||
@ -42,7 +42,7 @@ weight: 13
|
||||
|0463|Island Perimeter|[Go]({{< relref "/ChapterFour/0400~0499/0463.Island-Perimeter.md" >}})|Easy||||66.6%|
|
||||
|0500|Keyboard Row|[Go]({{< relref "/ChapterFour/0500~0599/0500.Keyboard-Row.md" >}})|Easy||||65.6%|
|
||||
|0508|Most Frequent Subtree Sum|[Go]({{< relref "/ChapterFour/0500~0599/0508.Most-Frequent-Subtree-Sum.md" >}})|Medium||||59.0%|
|
||||
|0575|Distribute Candies|[Go]({{< relref "/ChapterFour/0500~0599/0575.Distribute-Candies.md" >}})|Easy||||62.0%|
|
||||
|0575|Distribute Candies|[Go]({{< relref "/ChapterFour/0500~0599/0575.Distribute-Candies.md" >}})|Easy||||62.1%|
|
||||
|0594|Longest Harmonious Subsequence|[Go]({{< relref "/ChapterFour/0500~0599/0594.Longest-Harmonious-Subsequence.md" >}})|Easy||||51.2%|
|
||||
|0599|Minimum Index Sum of Two Lists|[Go]({{< relref "/ChapterFour/0500~0599/0599.Minimum-Index-Sum-of-Two-Lists.md" >}})|Easy||||51.6%|
|
||||
|0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0600~0699/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||54.1%|
|
||||
@ -76,7 +76,7 @@ weight: 13
|
||||
|1207|Unique Number of Occurrences|[Go]({{< relref "/ChapterFour/1200~1299/1207.Unique-Number-of-Occurrences.md" >}})|Easy||||71.7%|
|
||||
|1512|Number of Good Pairs|[Go]({{< relref "/ChapterFour/1500~1599/1512.Number-of-Good-Pairs.md" >}})|Easy||||87.7%|
|
||||
|1539|Kth Missing Positive Number|[Go]({{< relref "/ChapterFour/1500~1599/1539.Kth-Missing-Positive-Number.md" >}})|Easy||||55.1%|
|
||||
|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||60.2%|
|
||||
|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||60.1%|
|
||||
|1679|Max Number of K-Sum Pairs|[Go]({{< relref "/ChapterFour/1600~1699/1679.Max-Number-of-K-Sum-Pairs.md" >}})|Medium||||54.2%|
|
||||
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|
|
||||
|
||||
|
@ -27,7 +27,7 @@ weight: 4
|
||||
|0019|Remove Nth Node From End of List|[Go]({{< relref "/ChapterFour/0001~0099/0019.Remove-Nth-Node-From-End-of-List.md" >}})|Medium| O(n)| O(1)||35.7%|
|
||||
|0021|Merge Two Sorted Lists|[Go]({{< relref "/ChapterFour/0001~0099/0021.Merge-Two-Sorted-Lists.md" >}})|Easy| O(log n)| O(1)||55.9%|
|
||||
|0023|Merge k Sorted Lists|[Go]({{< relref "/ChapterFour/0001~0099/0023.Merge-k-Sorted-Lists.md" >}})|Hard| O(log n)| O(1)|❤️|42.6%|
|
||||
|0024|Swap Nodes in Pairs|[Go]({{< relref "/ChapterFour/0001~0099/0024.Swap-Nodes-in-Pairs.md" >}})|Medium| O(n)| O(1)||52.9%|
|
||||
|0024|Swap Nodes in Pairs|[Go]({{< relref "/ChapterFour/0001~0099/0024.Swap-Nodes-in-Pairs.md" >}})|Medium| O(n)| O(1)||53.0%|
|
||||
|0025|Reverse Nodes in k-Group|[Go]({{< relref "/ChapterFour/0001~0099/0025.Reverse-Nodes-in-k-Group.md" >}})|Hard| O(log n)| O(1)|❤️|44.7%|
|
||||
|0061|Rotate List|[Go]({{< relref "/ChapterFour/0001~0099/0061.Rotate-List.md" >}})|Medium| O(n)| O(1)||31.7%|
|
||||
|0082|Remove Duplicates from Sorted List II|[Go]({{< relref "/ChapterFour/0001~0099/0082.Remove-Duplicates-from-Sorted-List-II.md" >}})|Medium| O(n)| O(1)||39.2%|
|
||||
|
@ -19,7 +19,7 @@ weight: 12
|
||||
|0067|Add Binary|[Go]({{< relref "/ChapterFour/0001~0099/0067.Add-Binary.md" >}})|Easy||||46.8%|
|
||||
|0069|Sqrt(x)|[Go]({{< relref "/ChapterFour/0001~0099/0069.Sqrtx.md" >}})|Easy| O(log n)| O(1)||35.0%|
|
||||
|0168|Excel Sheet Column Title|[Go]({{< relref "/ChapterFour/0100~0199/0168.Excel-Sheet-Column-Title.md" >}})|Easy||||31.7%|
|
||||
|0171|Excel Sheet Column Number|[Go]({{< relref "/ChapterFour/0100~0199/0171.Excel-Sheet-Column-Number.md" >}})|Easy||||56.8%|
|
||||
|0171|Excel Sheet Column Number|[Go]({{< relref "/ChapterFour/0100~0199/0171.Excel-Sheet-Column-Number.md" >}})|Easy||||56.9%|
|
||||
|0172|Factorial Trailing Zeroes|[Go]({{< relref "/ChapterFour/0100~0199/0172.Factorial-Trailing-Zeroes.md" >}})|Easy||||38.5%|
|
||||
|0202|Happy Number|[Go]({{< relref "/ChapterFour/0200~0299/0202.Happy-Number.md" >}})|Easy| O(log n)| O(1)||51.2%|
|
||||
|0204|Count Primes|[Go]({{< relref "/ChapterFour/0200~0299/0204.Count-Primes.md" >}})|Easy||||32.2%|
|
||||
@ -34,8 +34,8 @@ weight: 12
|
||||
|0357|Count Numbers with Unique Digits|[Go]({{< relref "/ChapterFour/0300~0399/0357.Count-Numbers-with-Unique-Digits.md" >}})|Medium| O(1)| O(1)||48.8%|
|
||||
|0367|Valid Perfect Square|[Go]({{< relref "/ChapterFour/0300~0399/0367.Valid-Perfect-Square.md" >}})|Easy||||42.0%|
|
||||
|0372|Super Pow|[Go]({{< relref "/ChapterFour/0300~0399/0372.Super-Pow.md" >}})|Medium||||36.7%|
|
||||
|0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0300~0399/0397.Integer-Replacement.md" >}})|Medium||||33.4%|
|
||||
|0441|Arranging Coins|[Go]({{< relref "/ChapterFour/0400~0499/0441.Arranging-Coins.md" >}})|Easy||||42.4%|
|
||||
|0397|Integer Replacement|[Go]({{< relref "/ChapterFour/0300~0399/0397.Integer-Replacement.md" >}})|Medium||||33.5%|
|
||||
|0441|Arranging Coins|[Go]({{< relref "/ChapterFour/0400~0499/0441.Arranging-Coins.md" >}})|Easy||||42.3%|
|
||||
|0447|Number of Boomerangs|[Go]({{< relref "/ChapterFour/0400~0499/0447.Number-of-Boomerangs.md" >}})|Medium||||52.4%|
|
||||
|0453|Minimum Moves to Equal Array Elements|[Go]({{< relref "/ChapterFour/0400~0499/0453.Minimum-Moves-to-Equal-Array-Elements.md" >}})|Easy||||50.8%|
|
||||
|0483|Smallest Good Base|[Go]({{< relref "/ChapterFour/0400~0499/0483.Smallest-Good-Base.md" >}})|Hard||||36.2%|
|
||||
@ -61,14 +61,14 @@ weight: 12
|
||||
|0949|Largest Time for Given Digits|[Go]({{< relref "/ChapterFour/0900~0999/0949.Largest-Time-for-Given-Digits.md" >}})|Medium||||36.2%|
|
||||
|0952|Largest Component Size by Common Factor|[Go]({{< relref "/ChapterFour/0900~0999/0952.Largest-Component-Size-by-Common-Factor.md" >}})|Hard||||36.1%|
|
||||
|0970|Powerful Integers|[Go]({{< relref "/ChapterFour/0900~0999/0970.Powerful-Integers.md" >}})|Medium||||40.0%|
|
||||
|0976|Largest Perimeter Triangle|[Go]({{< relref "/ChapterFour/0900~0999/0976.Largest-Perimeter-Triangle.md" >}})|Easy| O(n log n)| O(log n) ||58.6%|
|
||||
|0976|Largest Perimeter Triangle|[Go]({{< relref "/ChapterFour/0900~0999/0976.Largest-Perimeter-Triangle.md" >}})|Easy| O(n log n)| O(log n) ||58.5%|
|
||||
|0996|Number of Squareful Arrays|[Go]({{< relref "/ChapterFour/0900~0999/0996.Number-of-Squareful-Arrays.md" >}})|Hard| O(n log n)| O(n) ||48.3%|
|
||||
|1017|Convert to Base -2|[Go]({{< relref "/ChapterFour/1000~1099/1017.Convert-to-Base--2.md" >}})|Medium||||59.6%|
|
||||
|1025|Divisor Game|[Go]({{< relref "/ChapterFour/1000~1099/1025.Divisor-Game.md" >}})|Easy| O(1)| O(1)||66.2%|
|
||||
|1037|Valid Boomerang|[Go]({{< relref "/ChapterFour/1000~1099/1037.Valid-Boomerang.md" >}})|Easy||||37.8%|
|
||||
|1073|Adding Two Negabinary Numbers|[Go]({{< relref "/ChapterFour/1000~1099/1073.Adding-Two-Negabinary-Numbers.md" >}})|Medium||||34.8%|
|
||||
|1093|Statistics from a Large Sample|[Go]({{< relref "/ChapterFour/1000~1099/1093.Statistics-from-a-Large-Sample.md" >}})|Medium||||49.3%|
|
||||
|1154|Day of the Year|[Go]({{< relref "/ChapterFour/1100~1199/1154.Day-of-the-Year.md" >}})|Easy||||49.3%|
|
||||
|1154|Day of the Year|[Go]({{< relref "/ChapterFour/1100~1199/1154.Day-of-the-Year.md" >}})|Easy||||49.2%|
|
||||
|1175|Prime Arrangements|[Go]({{< relref "/ChapterFour/1100~1199/1175.Prime-Arrangements.md" >}})|Easy||||52.0%|
|
||||
|1201|Ugly Number III|[Go]({{< relref "/ChapterFour/1200~1299/1201.Ugly-Number-III.md" >}})|Medium||||26.4%|
|
||||
|1217|Minimum Cost to Move Chips to The Same Position|[Go]({{< relref "/ChapterFour/1200~1299/1217.Minimum-Cost-to-Move-Chips-to-The-Same-Position.md" >}})|Easy||||71.2%|
|
||||
|
@ -35,7 +35,7 @@ weight: 17
|
||||
|0424|Longest Repeating Character Replacement|[Go]({{< relref "/ChapterFour/0400~0499/0424.Longest-Repeating-Character-Replacement.md" >}})|Medium| O(n)| O(1) ||48.2%|
|
||||
|0480|Sliding Window Median|[Go]({{< relref "/ChapterFour/0400~0499/0480.Sliding-Window-Median.md" >}})|Hard| O(n * log k)| O(k)|❤️|38.6%|
|
||||
|0567|Permutation in String|[Go]({{< relref "/ChapterFour/0500~0599/0567.Permutation-in-String.md" >}})|Medium| O(n)| O(1)|❤️|44.6%|
|
||||
|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0900~0999/0978.Longest-Turbulent-Subarray.md" >}})|Medium| O(n)| O(1)|❤️|46.6%|
|
||||
|0978|Longest Turbulent Subarray|[Go]({{< relref "/ChapterFour/0900~0999/0978.Longest-Turbulent-Subarray.md" >}})|Medium| O(n)| O(1)|❤️|46.7%|
|
||||
|0992|Subarrays with K Different Integers|[Go]({{< relref "/ChapterFour/0900~0999/0992.Subarrays-with-K-Different-Integers.md" >}})|Hard| O(n)| O(n)|❤️|50.6%|
|
||||
|0995|Minimum Number of K Consecutive Bit Flips|[Go]({{< relref "/ChapterFour/0900~0999/0995.Minimum-Number-of-K-Consecutive-Bit-Flips.md" >}})|Hard| O(n)| O(1)|❤️|49.8%|
|
||||
|1004|Max Consecutive Ones III|[Go]({{< relref "/ChapterFour/1000~1099/1004.Max-Consecutive-Ones-III.md" >}})|Medium| O(n)| O(1) ||60.7%|
|
||||
|
@ -41,17 +41,18 @@ weight: 14
|
||||
|0922|Sort Array By Parity II|[Go]({{< relref "/ChapterFour/0900~0999/0922.Sort-Array-By-Parity-II.md" >}})|Easy| O(n)| O(1) ||70.5%|
|
||||
|0969|Pancake Sorting|[Go]({{< relref "/ChapterFour/0900~0999/0969.Pancake-Sorting.md" >}})|Medium| O(n log n)| O(log n) |❤️|68.6%|
|
||||
|0973|K Closest Points to Origin|[Go]({{< relref "/ChapterFour/0900~0999/0973.K-Closest-Points-to-Origin.md" >}})|Medium| O(n log n)| O(log n) ||64.6%|
|
||||
|0976|Largest Perimeter Triangle|[Go]({{< relref "/ChapterFour/0900~0999/0976.Largest-Perimeter-Triangle.md" >}})|Easy| O(n log n)| O(log n) ||58.6%|
|
||||
|0976|Largest Perimeter Triangle|[Go]({{< relref "/ChapterFour/0900~0999/0976.Largest-Perimeter-Triangle.md" >}})|Easy| O(n log n)| O(log n) ||58.5%|
|
||||
|1030|Matrix Cells in Distance Order|[Go]({{< relref "/ChapterFour/1000~1099/1030.Matrix-Cells-in-Distance-Order.md" >}})|Easy| O(n^2)| O(1) ||66.9%|
|
||||
|1054|Distant Barcodes|[Go]({{< relref "/ChapterFour/1000~1099/1054.Distant-Barcodes.md" >}})|Medium| O(n log n)| O(log n) |❤️|44.2%|
|
||||
|1122|Relative Sort Array|[Go]({{< relref "/ChapterFour/1100~1199/1122.Relative-Sort-Array.md" >}})|Easy||||68.1%|
|
||||
|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1200~1299/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.3%|
|
||||
|1235|Maximum Profit in Job Scheduling|[Go]({{< relref "/ChapterFour/1200~1299/1235.Maximum-Profit-in-Job-Scheduling.md" >}})|Hard||||47.4%|
|
||||
|1305|All Elements in Two Binary Search Trees|[Go]({{< relref "/ChapterFour/1300~1399/1305.All-Elements-in-Two-Binary-Search-Trees.md" >}})|Medium||||77.8%|
|
||||
|1329|Sort the Matrix Diagonally|[Go]({{< relref "/ChapterFour/1300~1399/1329.Sort-the-Matrix-Diagonally.md" >}})|Medium||||81.8%|
|
||||
|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||60.2%|
|
||||
|1636|Sort Array by Increasing Frequency|[Go]({{< relref "/ChapterFour/1600~1699/1636.Sort-Array-by-Increasing-Frequency.md" >}})|Easy||||66.8%|
|
||||
|1640|Check Array Formation Through Concatenation|[Go]({{< relref "/ChapterFour/1600~1699/1640.Check-Array-Formation-Through-Concatenation.md" >}})|Easy||||60.1%|
|
||||
|1647|Minimum Deletions to Make Character Frequencies Unique|[Go]({{< relref "/ChapterFour/1600~1699/1647.Minimum-Deletions-to-Make-Character-Frequencies-Unique.md" >}})|Medium||||54.5%|
|
||||
|1648|Sell Diminishing-Valued Colored Balls|[Go]({{< relref "/ChapterFour/1600~1699/1648.Sell-Diminishing-Valued-Colored-Balls.md" >}})|Medium||||30.8%|
|
||||
|1691|Maximum Height by Stacking Cuboids|[Go]({{< relref "/ChapterFour/1600~1699/1691.Maximum-Height-by-Stacking-Cuboids.md" >}})|Hard||||49.9%|
|
||||
|1691|Maximum Height by Stacking Cuboids|[Go]({{< relref "/ChapterFour/1600~1699/1691.Maximum-Height-by-Stacking-Cuboids.md" >}})|Hard||||50.0%|
|
||||
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ weight: 5
|
||||
|0155|Min Stack|[Go]({{< relref "/ChapterFour/0100~0199/0155.Min-Stack.md" >}})|Easy| O(n)| O(n)||46.3%|
|
||||
|0173|Binary Search Tree Iterator|[Go]({{< relref "/ChapterFour/0100~0199/0173.Binary-Search-Tree-Iterator.md" >}})|Medium| O(n)| O(1)||60.0%|
|
||||
|0224|Basic Calculator|[Go]({{< relref "/ChapterFour/0200~0299/0224.Basic-Calculator.md" >}})|Hard| O(n)| O(n)||38.1%|
|
||||
|0225|Implement Stack using Queues|[Go]({{< relref "/ChapterFour/0200~0299/0225.Implement-Stack-using-Queues.md" >}})|Easy| O(n)| O(n)||47.2%|
|
||||
|0225|Implement Stack using Queues|[Go]({{< relref "/ChapterFour/0200~0299/0225.Implement-Stack-using-Queues.md" >}})|Easy| O(n)| O(n)||47.3%|
|
||||
|0232|Implement Queue using Stacks|[Go]({{< relref "/ChapterFour/0200~0299/0232.Implement-Queue-using-Stacks.md" >}})|Easy| O(n)| O(n)||52.0%|
|
||||
|0331|Verify Preorder Serialization of a Binary Tree|[Go]({{< relref "/ChapterFour/0300~0399/0331.Verify-Preorder-Serialization-of-a-Binary-Tree.md" >}})|Medium| O(n)| O(1)||41.0%|
|
||||
|0385|Mini Parser|[Go]({{< relref "/ChapterFour/0300~0399/0385.Mini-Parser.md" >}})|Medium||||34.5%|
|
||||
@ -41,7 +41,7 @@ weight: 5
|
||||
|0636|Exclusive Time of Functions|[Go]({{< relref "/ChapterFour/0600~0699/0636.Exclusive-Time-of-Functions.md" >}})|Medium| O(n)| O(n)||54.3%|
|
||||
|0682|Baseball Game|[Go]({{< relref "/ChapterFour/0600~0699/0682.Baseball-Game.md" >}})|Easy| O(n)| O(n)||66.7%|
|
||||
|0726|Number of Atoms|[Go]({{< relref "/ChapterFour/0700~0799/0726.Number-of-Atoms.md" >}})|Hard| O(n)| O(n) |❤️|51.1%|
|
||||
|0735|Asteroid Collision|[Go]({{< relref "/ChapterFour/0700~0799/0735.Asteroid-Collision.md" >}})|Medium| O(n)| O(n) ||43.2%|
|
||||
|0735|Asteroid Collision|[Go]({{< relref "/ChapterFour/0700~0799/0735.Asteroid-Collision.md" >}})|Medium| O(n)| O(n) ||43.3%|
|
||||
|0739|Daily Temperatures|[Go]({{< relref "/ChapterFour/0700~0799/0739.Daily-Temperatures.md" >}})|Medium| O(n)| O(n) ||64.5%|
|
||||
|0844|Backspace String Compare|[Go]({{< relref "/ChapterFour/0800~0899/0844.Backspace-String-Compare.md" >}})|Easy| O(n)| O(n) ||46.9%|
|
||||
|0856|Score of Parentheses|[Go]({{< relref "/ChapterFour/0800~0899/0856.Score-of-Parentheses.md" >}})|Medium| O(n)| O(n)||62.4%|
|
||||
|
@ -13,9 +13,9 @@ weight: 2
|
||||
|0013|Roman to Integer|[Go]({{< relref "/ChapterFour/0001~0099/0013.Roman-to-Integer.md" >}})|Easy||||56.5%|
|
||||
|0017|Letter Combinations of a Phone Number|[Go]({{< relref "/ChapterFour/0001~0099/0017.Letter-Combinations-of-a-Phone-Number.md" >}})|Medium| O(log n)| O(1)||49.0%|
|
||||
|0020|Valid Parentheses|[Go]({{< relref "/ChapterFour/0001~0099/0020.Valid-Parentheses.md" >}})|Easy| O(log n)| O(1)||39.8%|
|
||||
|0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0001~0099/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||65.1%|
|
||||
|0022|Generate Parentheses|[Go]({{< relref "/ChapterFour/0001~0099/0022.Generate-Parentheses.md" >}})|Medium| O(log n)| O(1)||65.2%|
|
||||
|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0001~0099/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.2%|
|
||||
|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0001~0099/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.1%|
|
||||
|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0001~0099/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.2%|
|
||||
|0049|Group Anagrams|[Go]({{< relref "/ChapterFour/0001~0099/0049.Group-Anagrams.md" >}})|Medium| O(n log n)| O(n)||59.2%|
|
||||
|0067|Add Binary|[Go]({{< relref "/ChapterFour/0001~0099/0067.Add-Binary.md" >}})|Easy||||46.8%|
|
||||
|0071|Simplify Path|[Go]({{< relref "/ChapterFour/0001~0099/0071.Simplify-Path.md" >}})|Medium| O(n)| O(n)||34.6%|
|
||||
@ -46,12 +46,15 @@ weight: 2
|
||||
|1234|Replace the Substring for Balanced String|[Go]({{< relref "/ChapterFour/1200~1299/1234.Replace-the-Substring-for-Balanced-String.md" >}})|Medium||||34.3%|
|
||||
|1455|Check If a Word Occurs As a Prefix of Any Word in a Sentence|[Go]({{< relref "/ChapterFour/1400~1499/1455.Check-If-a-Word-Occurs-As-a-Prefix-of-Any-Word-in-a-Sentence.md" >}})|Easy||||64.4%|
|
||||
|1573|Number of Ways to Split a String|[Go]({{< relref "/ChapterFour/1500~1599/1573.Number-of-Ways-to-Split-a-String.md" >}})|Medium||||31.0%|
|
||||
|1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1600~1699/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||50.6%|
|
||||
|1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1600~1699/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||83.3%|
|
||||
|1614|Maximum Nesting Depth of the Parentheses|[Go]({{< relref "/ChapterFour/1600~1699/1614.Maximum-Nesting-Depth-of-the-Parentheses.md" >}})|Easy||||83.1%|
|
||||
|1624|Largest Substring Between Two Equal Characters|[Go]({{< relref "/ChapterFour/1600~1699/1624.Largest-Substring-Between-Two-Equal-Characters.md" >}})|Easy||||58.9%|
|
||||
|1653|Minimum Deletions to Make String Balanced|[Go]({{< relref "/ChapterFour/1600~1699/1653.Minimum-Deletions-to-Make-String-Balanced.md" >}})|Medium||||50.5%|
|
||||
|1662|Check If Two String Arrays are Equivalent|[Go]({{< relref "/ChapterFour/1600~1699/1662.Check-If-Two-String-Arrays-are-Equivalent.md" >}})|Easy||||83.2%|
|
||||
|1668|Maximum Repeating Substring|[Go]({{< relref "/ChapterFour/1600~1699/1668.Maximum-Repeating-Substring.md" >}})|Easy||||38.5%|
|
||||
|1678|Goal Parser Interpretation|[Go]({{< relref "/ChapterFour/1600~1699/1678.Goal-Parser-Interpretation.md" >}})|Easy||||85.7%|
|
||||
|1684|Count the Number of Consistent Strings|[Go]({{< relref "/ChapterFour/1600~1699/1684.Count-the-Number-of-Consistent-Strings.md" >}})|Easy||||83.2%|
|
||||
|1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1600~1699/1694.Reformat-Phone-Number.md" >}})|Easy||||66.3%|
|
||||
|1694|Reformat Phone Number|[Go]({{< relref "/ChapterFour/1600~1699/1694.Reformat-Phone-Number.md" >}})|Easy||||66.2%|
|
||||
|1704|Determine if String Halves Are Alike|[Go]({{< relref "/ChapterFour/1700~1799/1704.Determine-if-String-Halves-Are-Alike.md" >}})|Easy||||77.6%|
|
||||
|------------|-------------------------------------------------------|-------| ----------------| ---------------|-------------|-------------|-------------|
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ weight: 3
|
||||
|0026|Remove Duplicates from Sorted Array|[Go]({{< relref "/ChapterFour/0001~0099/0026.Remove-Duplicates-from-Sorted-Array.md" >}})|Easy| O(n)| O(1)||46.5%|
|
||||
|0027|Remove Element|[Go]({{< relref "/ChapterFour/0001~0099/0027.Remove-Element.md" >}})|Easy| O(n)| O(1)||49.2%|
|
||||
|0028|Implement strStr()|[Go]({{< relref "/ChapterFour/0001~0099/0028.Implement-strStr.md" >}})|Easy| O(n)| O(1)||35.2%|
|
||||
|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0001~0099/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.1%|
|
||||
|0030|Substring with Concatenation of All Words|[Go]({{< relref "/ChapterFour/0001~0099/0030.Substring-with-Concatenation-of-All-Words.md" >}})|Hard| O(n)| O(n)|❤️|26.2%|
|
||||
|0042|Trapping Rain Water|[Go]({{< relref "/ChapterFour/0001~0099/0042.Trapping-Rain-Water.md" >}})|Hard| O(n)| O(1)|❤️|51.0%|
|
||||
|0061|Rotate List|[Go]({{< relref "/ChapterFour/0001~0099/0061.Rotate-List.md" >}})|Medium| O(n)| O(1)||31.7%|
|
||||
|0075|Sort Colors|[Go]({{< relref "/ChapterFour/0001~0099/0075.Sort-Colors.md" >}})|Medium| O(n)| O(1)|❤️|49.3%|
|
||||
@ -69,7 +69,7 @@ weight: 3
|
||||
|0632|Smallest Range Covering Elements from K Lists|[Go]({{< relref "/ChapterFour/0600~0699/0632.Smallest-Range-Covering-Elements-from-K-Lists.md" >}})|Hard||||54.1%|
|
||||
|0713|Subarray Product Less Than K|[Go]({{< relref "/ChapterFour/0700~0799/0713.Subarray-Product-Less-Than-K.md" >}})|Medium| O(n)| O(1)||40.5%|
|
||||
|0763|Partition Labels|[Go]({{< relref "/ChapterFour/0700~0799/0763.Partition-Labels.md" >}})|Medium| O(n)| O(1)|❤️|78.0%|
|
||||
|0826|Most Profit Assigning Work|[Go]({{< relref "/ChapterFour/0800~0899/0826.Most-Profit-Assigning-Work.md" >}})|Medium| O(n log n)| O(n)||39.0%|
|
||||
|0826|Most Profit Assigning Work|[Go]({{< relref "/ChapterFour/0800~0899/0826.Most-Profit-Assigning-Work.md" >}})|Medium| O(n log n)| O(n)||39.1%|
|
||||
|0828|Count Unique Characters of All Substrings of a Given String|[Go]({{< relref "/ChapterFour/0800~0899/0828.Count-Unique-Characters-of-All-Substrings-of-a-Given-String.md" >}})|Hard| O(n)| O(1)|❤️|46.8%|
|
||||
|0838|Push Dominoes|[Go]({{< relref "/ChapterFour/0800~0899/0838.Push-Dominoes.md" >}})|Medium| O(n)| O(n)||49.8%|
|
||||
|0844|Backspace String Compare|[Go]({{< relref "/ChapterFour/0800~0899/0844.Backspace-String-Compare.md" >}})|Easy| O(n)| O(n) ||46.9%|
|
||||
|
@ -21,17 +21,17 @@ weight: 16
|
||||
|:--------:|:------- | :--------: | :----------: | :----: | :-----: | :-----: |:-----: |
|
||||
|0128|Longest Consecutive Sequence|[Go]({{< relref "/ChapterFour/0100~0199/0128.Longest-Consecutive-Sequence.md" >}})|Hard| O(n)| O(n)|❤️|46.2%|
|
||||
|0130|Surrounded Regions|[Go]({{< relref "/ChapterFour/0100~0199/0130.Surrounded-Regions.md" >}})|Medium| O(m\*n)| O(m\*n)||29.3%|
|
||||
|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200~0299/0200.Number-of-Islands.md" >}})|Medium| O(m\*n)| O(m\*n)||48.9%|
|
||||
|0200|Number of Islands|[Go]({{< relref "/ChapterFour/0200~0299/0200.Number-of-Islands.md" >}})|Medium| O(m\*n)| O(m\*n)||49.0%|
|
||||
|0399|Evaluate Division|[Go]({{< relref "/ChapterFour/0300~0399/0399.Evaluate-Division.md" >}})|Medium| O(n)| O(n)||54.2%|
|
||||
|0547|Number of Provinces|[Go]({{< relref "/ChapterFour/0500~0599/0547.Number-of-Provinces.md" >}})|Medium| O(n^2)| O(n)||60.4%|
|
||||
|0684|Redundant Connection|[Go]({{< relref "/ChapterFour/0600~0699/0684.Redundant-Connection.md" >}})|Medium| O(n)| O(n)||58.9%|
|
||||
|0685|Redundant Connection II|[Go]({{< relref "/ChapterFour/0600~0699/0685.Redundant-Connection-II.md" >}})|Hard| O(n)| O(n)||33.0%|
|
||||
|0721|Accounts Merge|[Go]({{< relref "/ChapterFour/0700~0799/0721.Accounts-Merge.md" >}})|Medium| O(n)| O(n)|❤️|51.6%|
|
||||
|0765|Couples Holding Hands|[Go]({{< relref "/ChapterFour/0700~0799/0765.Couples-Holding-Hands.md" >}})|Hard| O(n)| O(n)|❤️|55.4%|
|
||||
|0765|Couples Holding Hands|[Go]({{< relref "/ChapterFour/0700~0799/0765.Couples-Holding-Hands.md" >}})|Hard| O(n)| O(n)|❤️|55.5%|
|
||||
|0778|Swim in Rising Water|[Go]({{< relref "/ChapterFour/0700~0799/0778.Swim-in-Rising-Water.md" >}})|Hard| O(n^2)| O(n)|❤️|54.8%|
|
||||
|0803|Bricks Falling When Hit|[Go]({{< relref "/ChapterFour/0800~0899/0803.Bricks-Falling-When-Hit.md" >}})|Hard| O(n^2)| O(n)|❤️|31.4%|
|
||||
|0839|Similar String Groups|[Go]({{< relref "/ChapterFour/0800~0899/0839.Similar-String-Groups.md" >}})|Hard| O(n^2)| O(n)||40.5%|
|
||||
|0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0900~0999/0924.Minimize-Malware-Spread.md" >}})|Hard| O(m\*n)| O(n)||41.8%|
|
||||
|0924|Minimize Malware Spread|[Go]({{< relref "/ChapterFour/0900~0999/0924.Minimize-Malware-Spread.md" >}})|Hard| O(m\*n)| O(n)||41.9%|
|
||||
|0928|Minimize Malware Spread II|[Go]({{< relref "/ChapterFour/0900~0999/0928.Minimize-Malware-Spread-II.md" >}})|Hard| O(m\*n)| O(n)|❤️|41.2%|
|
||||
|0947|Most Stones Removed with Same Row or Column|[Go]({{< relref "/ChapterFour/0900~0999/0947.Most-Stones-Removed-with-Same-Row-or-Column.md" >}})|Medium| O(n)| O(n)||55.4%|
|
||||
|0952|Largest Component Size by Common Factor|[Go]({{< relref "/ChapterFour/0900~0999/0952.Largest-Component-Size-by-Common-Factor.md" >}})|Hard| O(n)| O(n)|❤️|36.1%|
|
||||
|
Reference in New Issue
Block a user