Skip to content

Commit 8dcbe3c

Browse files
committed
update 41 442
1 parent e1a0800 commit 8dcbe3c

File tree

2,157 files changed

+30758
-25204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,157 files changed

+30758
-25204
lines changed

assets/output/0027.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ to get accepted, you need to do the following things:
4343

4444
## 解题思路
4545

46+
#### 复杂度分析
47+
48+
- **时间复杂度**`O()`
49+
- **空间复杂度**`O()`
50+
4651
## 代码
4752

4853
```javascript

assets/output/0029.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ return `-2^31`.
4242

4343
## 解题思路
4444

45+
#### 复杂度分析
46+
47+
- **时间复杂度**`O()`
48+
- **空间复杂度**`O()`
49+
4550
## 代码
4651

4752
```javascript

assets/output/0031.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ place_algorithm)** and use only constant extra memory.
6565

6666
## 解题思路
6767

68+
#### 复杂度分析
69+
70+
- **时间复杂度**`O()`
71+
- **空间复杂度**`O()`
72+
6873
## 代码
6974

7075
```javascript

assets/output/0037.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,41 @@ Write a program to solve a Sudoku puzzle by filling the empty cells.
66

77
A sudoku solution must satisfy **all of the following rules** :
88

9-
1. Each of the digits `1-9` must occur exactly once in each row.
10-
2. Each of the digits `1-9` must occur exactly once in each column.
11-
3. Each of the digits `1-9` must occur exactly once in each of the 9 `3x3` sub-boxes of the grid.
9+
1. Each of the digits `1-9` must occur exactly once in each row.
10+
2. Each of the digits `1-9` must occur exactly once in each column.
11+
3. Each of the digits `1-9` must occur exactly once in each of the 9 `3x3` sub-boxes of the grid.
1212

1313
The `'.'` character indicates empty cells.
1414

15-
16-
1715
**Example 1:**
1816

1917
![](https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Sudoku-
2018
by-L2G-20050714.svg/250px-Sudoku-by-L2G-20050714.svg.png)
2119

2220
> Input: board = [["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".","8",".",".","7","9"]]
23-
>
21+
>
2422
> Output: [["5","3","4","6","7","8","9","1","2"],["6","7","2","1","9","5","3","4","8"],["1","9","8","3","4","2","5","6","7"],["8","5","9","7","6","1","4","2","3"],["4","2","6","8","5","3","7","9","1"],["7","1","3","9","2","4","8","5","6"],["9","6","1","5","3","7","2","8","4"],["2","8","7","4","1","9","6","3","5"],["3","4","5","2","8","6","1","7","9"]]
25-
>
26-
> Explanation: The input board is shown above and the only valid solution is shown below:
27-
>
28-
>
29-
>
23+
>
24+
> Explanation: The input board is shown above and the only valid solution is shown below:
25+
>
3026
> ![](https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Sudoku-by-L2G-20050714_solution.svg/250px-Sudoku-by-L2G-20050714_solution.svg.png)
3127
3228
**Constraints:**
3329

34-
* `board.length == 9`
35-
* `board[i].length == 9`
36-
* `board[i][j]` is a digit or `'.'`.
37-
* It is **guaranteed** that the input board has only one solution.
38-
30+
- `board.length == 9`
31+
- `board[i].length == 9`
32+
- `board[i][j]` is a digit or `'.'`.
33+
- It is **guaranteed** that the input board has only one solution.
3934

4035
## 题目大意
4136

4237
## 解题思路
4338

39+
#### 复杂度分析
40+
41+
- **时间复杂度**`O()`
42+
- **空间复杂度**`O()`
43+
4444
## 代码
4545

4646
```javascript
@@ -50,6 +50,7 @@ by-L2G-20050714.svg/250px-Sudoku-by-L2G-20050714.svg.png)
5050
## 相关题目
5151

5252
:::: md-demo 相关题目
53+
5354
- [36. 有效的数独](./0036.md)
5455
- [980. 不同路径 III](https://leetcode.com/problems/unique-paths-iii)
5556

assets/output/0038.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
The **count-and-say** sequence is a sequence of digit strings defined by the
66
recursive formula:
77

8-
* `countAndSay(1) = "1"`
9-
* `countAndSay(n)` is the way you would "say" the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
8+
- `countAndSay(1) = "1"`
9+
- `countAndSay(n)` is the way you would "say" the digit string from `countAndSay(n-1)`, which is then converted into a different digit string.
1010

1111
To determine how you "say" a digit string, split it into the **minimal**
1212
number of substrings such that each substring contains exactly **one** unique
@@ -20,41 +20,43 @@ For example, the saying and conversion for digit string `"3322251"`:
2020
Given a positive integer `n`, return _the_`nth` _term of the **count-and-say**
2121
sequence_.
2222

23-
24-
2523
**Example 1:**
2624

2725
> Input: n = 1
28-
>
26+
>
2927
> Output: "1"
30-
>
28+
>
3129
> Explanation: This is the base case.
3230
3331
**Example 2:**
3432

3533
> Input: n = 4
36-
>
34+
>
3735
> Output: "1211"
38-
>
36+
>
3937
> Explanation:
40-
>
38+
>
4139
> countAndSay(1) = "1"
42-
>
40+
>
4341
> countAndSay(2) = say "1" = one 1 = "11"
44-
>
42+
>
4543
> countAndSay(3) = say "11" = two 1's = "21"
46-
>
44+
>
4745
> countAndSay(4) = say "21" = one 2 + one 1 = "12" + "11" = "1211"
4846
4947
**Constraints:**
5048

51-
* `1 <= n <= 30`
52-
49+
- `1 <= n <= 30`
5350

5451
## 题目大意
5552

5653
## 解题思路
5754

55+
#### 复杂度分析
56+
57+
- **时间复杂度**`O()`
58+
- **空间复杂度**`O()`
59+
5860
## 代码
5961

6062
```javascript
@@ -64,6 +66,7 @@ sequence_.
6466
## 相关题目
6567

6668
:::: md-demo 相关题目
69+
6770
- [🔒 Encode and Decode Strings](https://leetcode.com/problems/encode-and-decode-strings)
6871
- [443. 压缩字符串](https://leetcode.com/problems/string-compression)
6972

assets/output/0041.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ auxiliary space.
4141

4242
## 解题思路
4343

44+
#### 复杂度分析
45+
46+
- **时间复杂度**`O()`
47+
- **空间复杂度**`O()`
48+
4449
## 代码
4550

4651
```javascript

assets/output/0043.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,36 @@
55
Given two non-negative integers `num1` and `num2` represented as strings,
66
return the product of `num1` and `num2`, also represented as a string.
77

8-
**Note:** You must not use any built-in BigInteger library or convert the
8+
**Note:** You must not use any built-in BigInteger library or convert the
99
inputs to integer directly.
1010

11-
12-
1311
**Example 1:**
1412

1513
> Input: num1 = "2", num2 = "3"
16-
>
14+
>
1715
> Output: "6"
1816
1917
**Example 2:**
2018

2119
> Input: num1 = "123", num2 = "456"
22-
>
20+
>
2321
> Output: "56088"
2422
2523
**Constraints:**
2624

27-
* `1 <= num1.length, num2.length <= 200`
28-
* `num1` and `num2` consist of digits only.
29-
* Both `num1` and `num2` do not contain any leading zero, except the number `0` itself.
30-
25+
- `1 <= num1.length, num2.length <= 200`
26+
- `num1` and `num2` consist of digits only.
27+
- Both `num1` and `num2` do not contain any leading zero, except the number `0` itself.
3128

3229
## 题目大意
3330

3431
## 解题思路
3532

33+
#### 复杂度分析
34+
35+
- **时间复杂度**`O()`
36+
- **空间复杂度**`O()`
37+
3638
## 代码
3739

3840
```javascript
@@ -42,6 +44,7 @@ inputs to integer directly.
4244
## 相关题目
4345

4446
:::: md-demo 相关题目
47+
4548
- [2. 两数相加](./0002.md)
4649
- [66. 加一](./0066.md)
4750
- [67. 二进制求和](https://leetcode.com/problems/add-binary)

assets/output/0048.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,37 @@ You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-
99
place_algorithm), which means you have to modify the input 2D matrix directly.
1010
**DO NOT** allocate another 2D matrix and do the rotation.
1111

12-
13-
1412
**Example 1:**
1513

1614
![](https://assets.leetcode.com/uploads/2020/08/28/mat1.jpg)
1715

1816
> Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]
19-
>
17+
>
2018
> Output: [[7,4,1],[8,5,2],[9,6,3]]
2119
2220
**Example 2:**
2321

2422
![](https://assets.leetcode.com/uploads/2020/08/28/mat2.jpg)
2523

2624
> Input: matrix = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]]
27-
>
25+
>
2826
> Output: [[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]]
2927
3028
**Constraints:**
3129

32-
* `n == matrix.length == matrix[i].length`
33-
* `1 <= n <= 20`
34-
* `-1000 <= matrix[i][j] <= 1000`
35-
30+
- `n == matrix.length == matrix[i].length`
31+
- `1 <= n <= 20`
32+
- `-1000 <= matrix[i][j] <= 1000`
3633

3734
## 题目大意
3835

3936
## 解题思路
4037

38+
#### 复杂度分析
39+
40+
- **时间复杂度**`O()`
41+
- **空间复杂度**`O()`
42+
4143
## 代码
4244

4345
```javascript
@@ -47,6 +49,7 @@ place_algorithm), which means you have to modify the input 2D matrix directly.
4749
## 相关题目
4850

4951
:::: md-demo 相关题目
52+
5053
- [1886. 判断矩阵经轮转后是否一致](https://leetcode.com/problems/determine-whether-matrix-can-be-obtained-by-rotation)
5154

5255
::::

assets/output/0050.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ calculates `x` raised to the power `n` (i.e., `xn`).
3737

3838
## 解题思路
3939

40+
#### 复杂度分析
41+
42+
- **时间复杂度**`O()`
43+
- **空间复杂度**`O()`
44+
4045
## 代码
4146

4247
```javascript

assets/output/0058.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ A **word** is a maximal substring consisting of non-space characters only.
4141

4242
## 解题思路
4343

44+
#### 复杂度分析
45+
46+
- **时间复杂度**`O()`
47+
- **空间复杂度**`O()`
48+
4449
## 代码
4550

4651
```javascript

0 commit comments

Comments
 (0)