Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions src/main/java/g0001_0100/s0023_merge_k_sorted_lists/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Merge all the linked-lists into one sorted linked-list and return it._

**Example 1:**

**Input:** lists = [[1,4,5],[1,3,4],[2,6]]
**Input:** lists = \[\[1,4,5],[1,3,4],[2,6]]

**Output:** [1,1,2,3,4,4,5,6]

Expand All @@ -22,7 +22,7 @@ _Merge all the linked-lists into one sorted linked-list and return it._

**Example 3:**

**Input:** lists = [[]]
**Input:** lists = \[\[]]

**Output:** []

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/g0001_0100/s0037_sudoku_solver/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The `'.'` character indicates empty cells.

**Input:**

board = [["5","3",".",".","7",".",".",".","."],
board = [ ["5","3",".",".","7",".",".",".","."],
["6",".",".","1","9","5",".",".","."],
[".","9","8",".",".",".",".","6","."],
["8",".",".",".","6",".",".",".","3"],
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/g0001_0100/s0048_rotate_image/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ You have to rotate the image [**in-place**](https://en.wikipedia.org/wiki/In-pla

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

**Input:** matrix = [[1,2,3],[4,5,6],[7,8,9]]
**Input:** matrix = \[\[1,2,3],[4,5,6],[7,8,9]]

**Output:** [[7,4,1],[8,5,2],[9,6,3]]

**Example 2:**

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

**Input:** matrix = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]]
**Input:** matrix = \[\[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]]

**Output:** [[15,13,2,5],[14,3,4,1],[12,6,8,9],[16,7,10,11]]

**Example 3:**

**Input:** matrix = [[1]]
**Input:** matrix = \[\[1]]

**Output:** [[1]]

**Example 4:**

**Input:** matrix = [[1,2],[3,4]]
**Input:** matrix = \[\[1,2],[3,4]]

**Output:** [[3,1],[4,2]]

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0001_0100/s0054_spiral_matrix/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Given an `m x n` `matrix`, return _all elements of the_ `matrix` _in spiral orde

![](https://assets.leetcode.com/uploads/2020/11/13/spiral1.jpg)

**Input:** matrix = [[1,2,3],[4,5,6],[7,8,9]]
**Input:** matrix = \[\[1,2,3],[4,5,6],[7,8,9]]

**Output:** [1,2,3,6,9,8,7,4,5]

**Example 2:**

![](https://assets.leetcode.com/uploads/2020/11/13/spiral.jpg)

**Input:** matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
**Input:** matrix = \[\[1,2,3,4],[5,6,7,8],[9,10,11,12]]

**Output:** [1,2,3,4,8,12,11,10,9,5,6,7]

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0001_0100/s0056_merge_intervals/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Given an array of `intervals` where <code>intervals[i] = [start<sub>i</sub>, end

**Example 1:**

**Input:** intervals = [[1,3],[2,6],[8,10],[15,18]]
**Input:** intervals = \[\[1,3],[2,6],[8,10],[15,18]]

**Output:** [[1,6],[8,10],[15,18]]

**Explanation:** Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].

**Example 2:**

**Input:** intervals = [[1,4],[4,5]]
**Input:** intervals = \[\[1,4],[4,5]]

**Output:** [[1,5]]

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/g0001_0100/s0057_insert_interval/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Return `intervals` _after the insertion_.

**Example 1:**

**Input:** intervals = [[1,3],[6,9]], newInterval = [2,5]
**Input:** intervals = \[\[1,3],[6,9]], newInterval = [2,5]

**Output:** [[1,5],[6,9]]

**Example 2:**

**Input:** intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]
**Input:** intervals = \[\[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]

**Output:** [[1,2],[3,10],[12,16]]

Expand All @@ -30,13 +30,13 @@ Return `intervals` _after the insertion_.

**Example 4:**

**Input:** intervals = [[1,5]], newInterval = [2,3]
**Input:** intervals = \[\[1,5]], newInterval = [2,3]

**Output:** [[1,5]]

**Example 5:**

**Input:** intervals = [[1,5]], newInterval = [2,7]
**Input:** intervals = \[\[1,5]], newInterval = [2,7]

**Output:** [[1,7]]

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0001_0100/s0063_unique_paths_ii/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ An obstacle and space is marked as `1` and `0` respectively in the grid.

![](https://assets.leetcode.com/uploads/2020/11/04/robot1.jpg)

**Input:** obstacleGrid = [[0,0,0],[0,1,0],[0,0,0]]
**Input:** obstacleGrid = \[\[0,0,0],[0,1,0],[0,0,0]]

**Output:** 2

Expand All @@ -24,7 +24,7 @@ An obstacle and space is marked as `1` and `0` respectively in the grid.

![](https://assets.leetcode.com/uploads/2020/11/04/robot2.jpg)

**Input:** obstacleGrid = [[0,1],[0,0]]
**Input:** obstacleGrid = \[\[0,1],[0,0]]

**Output:** 1

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0001_0100/s0064_minimum_path_sum/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Given a `m x n` `grid` filled with non-negative numbers, find a path from top le

![](https://assets.leetcode.com/uploads/2020/11/05/minpath.jpg)

**Input:** grid = [[1,3,1],[1,5,1],[4,2,1]]
**Input:** grid = \[\[1,3,1],[1,5,1],[4,2,1]]

**Output:** 7

**Explanation:** Because the path 1 → 3 → 1 → 1 → 1 minimizes the sum.

**Example 2:**

**Input:** grid = [[1,2,3],[4,5,6]]
**Input:** grid = \[\[1,2,3],[4,5,6]]

**Output:** 12

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0001_0100/s0073_set_matrix_zeroes/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm).

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

**Input:** matrix = [[1,1,1],[1,0,1],[1,1,1]]
**Input:** matrix = \[\[1,1,1],[1,0,1],[1,1,1]]

**Output:** [[1,0,1],[0,0,0],[1,0,1]]

**Example 2:**

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

**Input:** matrix = [[0,1,2,0],[3,4,5,2],[1,3,1,5]]
**Input:** matrix = \[\[0,1,2,0],[3,4,5,2],[1,3,1,5]]

**Output:** [[0,0,0,0],[0,4,5,0],[0,3,1,0]]

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0001_0100/s0074_search_a_2d_matrix/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Write an efficient algorithm that searches for a value in an `m x n` matrix. Thi

![](https://assets.leetcode.com/uploads/2020/10/05/mat.jpg)

**Input:** matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3
**Input:** matrix = \[\[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3

**Output:** true

**Example 2:**

![](https://assets.leetcode.com/uploads/2020/10/05/mat2.jpg)

**Input:** matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13
**Input:** matrix = \[\[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13

**Output:** false

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/g0001_0100/s0079_word_search/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ The word can be constructed from letters of sequentially adjacent cells, where a

![](https://assets.leetcode.com/uploads/2020/11/04/word2.jpg)

**Input:** board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"
**Input:** board = \[\["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"

**Output:** true

**Example 2:**

![](https://assets.leetcode.com/uploads/2020/11/04/word-1.jpg)

**Input:** board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"
**Input:** board = \[\["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"

**Output:** true

**Example 3:**

![](https://assets.leetcode.com/uploads/2020/10/15/word3.jpg)

**Input:** board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"
**Input:** board = \[\["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"

**Output:** false

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/g0001_0100/s0085_maximal_rectangle/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Given a `rows x cols` binary `matrix` filled with `0`'s and `1`'s, find the larg

![](https://assets.leetcode.com/uploads/2020/09/14/maximal.jpg)

**Input:** matrix = [["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]
**Input:** matrix = \[\["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]]

**Output:** 6

Expand All @@ -22,19 +22,19 @@ Given a `rows x cols` binary `matrix` filled with `0`'s and `1`'s, find the larg

**Example 3:**

**Input:** matrix = [["0"]]
**Input:** matrix = \[\["0"]]

**Output:** 0

**Example 4:**

**Input:** matrix = [["1"]]
**Input:** matrix = \[\["1"]]

**Output:** 1

**Example 5:**

**Input:** matrix = [["0","0"]]
**Input:** matrix = \[\["0","0"]]

**Output:** 0

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0101_0200/s0120_triangle/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ For each step, you may move to an adjacent number of the row below. More formall

**Example 1:**

**Input:** triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]
**Input:** triangle = \[\[2],[3,4],[6,5,7],[4,1,8,3]]

**Output:** 11

Expand All @@ -23,7 +23,7 @@ For each step, you may move to an adjacent number of the row below. More formall

**Example 2:**

**Input:** triangle = [[-10]]
**Input:** triangle = \[\[-10]]

**Output:** -10

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0101_0200/s0130_surrounded_regions/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded r

![](https://assets.leetcode.com/uploads/2021/02/19/xogrid.jpg)

**Input:** board = [["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]]
**Input:** board = \[\["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]]

**Output:** [["X","X","X","X"],["X","X","X","X"],["X","X","X","X"],["X","O","X","X"]]

**Explanation:** Surrounded regions should not be on the border, which means that any 'O' on the border of the board are not flipped to 'X'. Any 'O' that is not on the border and it is not connected to an 'O' on the border will be flipped to 'X'. Two cells are connected if they are adjacent cells connected horizontally or vertically.

**Example 2:**

**Input:** board = [["X"]]
**Input:** board = \[\["X"]]

**Output:** [["X"]]

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/g0101_0200/s0133_clone_graph/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The given node will always be the first node with `val = 1`. You must return the

![](https://assets.leetcode.com/uploads/2019/11/04/133_clone_graph_question.png)

**Input:** adjList = [[2,4],[1,3],[2,4],[1,3]]
**Input:** adjList = \[\[2,4],[1,3],[2,4],[1,3]]

**Output:** [[2,4],[1,3],[2,4],[1,3]]

Expand All @@ -38,7 +38,7 @@ The given node will always be the first node with `val = 1`. You must return the

![](https://assets.leetcode.com/uploads/2020/01/07/graph.png)

**Input:** adjList = [[]]
**Input:** adjList = \[\[]]

**Output:** [[]]

Expand All @@ -56,7 +56,7 @@ The given node will always be the first node with `val = 1`. You must return the

![](https://assets.leetcode.com/uploads/2020/01/07/graph-1.png)

**Input:** adjList = [[2],[1]]
**Input:** adjList = \[\[2],[1]]

**Output:** [[2],[1]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ Your code will **only** be given the `head` of the original linked list.

![](https://assets.leetcode.com/uploads/2019/12/18/e1.png)

**Input:** head = [[7,null],[13,0],[11,4],[10,2],[1,0]]
**Input:** head = \[\[7,null],[13,0],[11,4],[10,2],[1,0]]

**Output:** [[7,null],[13,0],[11,4],[10,2],[1,0]]

**Example 2:**

![](https://assets.leetcode.com/uploads/2019/12/18/e2.png)

**Input:** head = [[1,1],[2,1]]
**Input:** head = \[\[1,1],[2,1]]

**Output:** [[1,1],[2,1]]

**Example 3:**

**![](https://assets.leetcode.com/uploads/2019/12/18/e3.png)**

**Input:** head = [[3,null],[3,0],[3,null]]
**Input:** head = \[\[3,null],[3,0],[3,null]]

**Output:** [[3,null],[3,0],[3,null]]

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0101_0200/s0149_max_points_on_a_line/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Given an array of `points` where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>

![](https://assets.leetcode.com/uploads/2021/02/25/plane1.jpg)

**Input:** points = [[1,1],[2,2],[3,3]]
**Input:** points = \[\[1,1],[2,2],[3,3]]

**Output:** 3

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/02/25/plane2.jpg)

**Input:** points = [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]
**Input:** points = \[\[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]

**Output:** 4

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/g0101_0200/s0174_dungeon_game/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Return _the knight's minimum initial health so that he can rescue the princess_.

![](https://assets.leetcode.com/uploads/2021/03/13/dungeon-grid-1.jpg)

**Input:** dungeon = [[-2,-3,3],[-5,-10,1],[10,30,-5]]
**Input:** dungeon = \[\[-2,-3,3],[-5,-10,1],[10,30,-5]]

**Output:** 7

**Explanation:** The initial health of the knight must be at least 7 if he follows the optimal path: RIGHT-> RIGHT -> DOWN -> DOWN.

**Example 2:**

**Input:** dungeon = [[0]]
**Input:** dungeon = \[\[0]]

**Output:** 1

Expand Down
Loading