Skip to content

Commit e2f9320

Browse files
committed
Update readme for tasks 103-133
1 parent a514d4f commit e2f9320

File tree

11 files changed

+37
-62
lines changed

11 files changed

+37
-62
lines changed

src/main/java/g0101_0200/s0104_maximum_depth_of_binary_tree/readme.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@ A binary tree's **maximum depth** is the number of nodes along the longest path
2020

2121
**Output:** 2
2222

23-
**Example 3:**
24-
25-
**Input:** root = []
26-
27-
**Output:** 0
28-
29-
**Example 4:**
30-
31-
**Input:** root = [0]
32-
33-
**Output:** 1
34-
3523
**Constraints:**
3624

3725
* The number of nodes in the tree is in the range <code>[0, 10<sup>4</sup>]</code>.

src/main/java/g0101_0200/s0108_convert_sorted_array_to_binary_search_tree/readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
Easy
44

5-
Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a **height-balanced** binary search tree_.
6-
7-
A **height-balanced** binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one.
5+
Given an integer array `nums` where the elements are sorted in **ascending order**, convert _it to a_ **_height-balanced_** _binary search tree_.
86

97
**Example 1:**
108

@@ -24,7 +22,7 @@ A **height-balanced** binary tree is a binary tree in which the depth of the two
2422

2523
**Output:** [3,1]
2624

27-
**Explanation:** [1,3] and [3,1] are both a height-balanced BSTs.
25+
**Explanation:** [1,null,3] and [3,1] are both height-balanced BSTs.
2826

2927
**Constraints:**
3028

src/main/java/g0101_0200/s0112_path_sum/readme.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,27 @@ A **leaf** is a node with no children.
1212

1313
**Input:** root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22
1414

15-
**Output:** true
15+
**Output:** true
16+
17+
**Explanation:** The root-to-leaf path with the target sum is shown.
1618

1719
**Example 2:**
1820

1921
![](https://assets.leetcode.com/uploads/2021/01/18/pathsum2.jpg)
2022

2123
**Input:** root = [1,2,3], targetSum = 5
2224

23-
**Output:** false
25+
**Output:** false
26+
27+
**Explanation:** There are two root-to-leaf paths in the tree: (1 --> 2): The sum is 3. (1 --> 3): The sum is 4. There is no root-to-leaf path with sum = 5.
2428

2529
**Example 3:**
2630

27-
**Input:** root = [1,2], targetSum = 0
31+
**Input:** root = [], targetSum = 0
32+
33+
**Output:** false
2834

29-
**Output:** false
35+
**Explanation:** Since the tree is empty, there are no root-to-leaf paths.
3036

3137
**Constraints:**
3238

src/main/java/g0101_0200/s0120_triangle/readme.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ For each step, you may move to an adjacent number of the row below. More formall
1212

1313
**Output:** 11
1414

15-
**Explanation:**
16-
17-
The triangle looks like:
18-
2
19-
3 4
20-
6 5 7
21-
4 1 8 3
22-
The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (underlined above).
15+
**Explanation:** The triangle looks like: <ins>2</ins> <ins>3</ins> 4 6 <ins>5</ins> 7 4 <ins>1</ins> 8 3 The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11 (underlined above).
2316

2417
**Example 2:**
2518

src/main/java/g0101_0200/s0121_best_time_to_buy_and_sell_stock/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Easy
44

5-
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
5+
You are given an array `prices` where `prices[i]` is the price of a given stock on the <code>i<sup>th</sup></code> day.
66

77
You want to maximize your profit by choosing a **single day** to buy one stock and choosing a **different day in the future** to sell that stock.
88

src/main/java/g0101_0200/s0122_best_time_to_buy_and_sell_stock_ii/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Medium
44

5-
You are given an integer array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
5+
You are given an integer array `prices` where `prices[i]` is the price of a given stock on the <code>i<sup>th</sup></code> day.
66

7-
On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can buy it then immediately sell it on the **same day**.
7+
On each day, you may decide to buy and/or sell the stock. You can only hold **at most one** share of the stock at any time. However, you can sell and buy the stock multiple times on the **same day**, ensuring you never hold more than one share of the stock.
88

99
Find and return _the **maximum** profit you can achieve_.
1010

src/main/java/g0101_0200/s0123_best_time_to_buy_and_sell_stock_iii/readme.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Hard
44

5-
You are given an array `prices` where `prices[i]` is the price of a given stock on the `ith` day.
5+
You are given an array `prices` where `prices[i]` is the price of a given stock on the <code>i<sup>th</sup></code> day.
66

77
Find the maximum profit you can achieve. You may complete **at most two transactions**.
88

@@ -32,12 +32,6 @@ Find the maximum profit you can achieve. You may complete **at most two transact
3232

3333
**Explanation:** In this case, no transaction is done, i.e. max profit = 0.
3434

35-
**Example 4:**
36-
37-
**Input:** prices = [1]
38-
39-
**Output:** 0
40-
4135
**Constraints:**
4236

4337
* <code>1 <= prices.length <= 10<sup>5</sup></code>

src/main/java/g0101_0200/s0128_longest_consecutive_sequence/readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ You must write an algorithm that runs in `O(n)` time.
2020

2121
**Output:** 9
2222

23+
**Example 3:**
24+
25+
**Input:** nums = [1,0,1,2]
26+
27+
**Output:** 3
28+
2329
**Constraints:**
2430

2531
* <code>0 <= nums.length <= 10<sup>5</sup></code>

src/main/java/g0101_0200/s0130_surrounded_regions/readme.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22

33
Medium
44

5-
Given an `m x n` matrix `board` containing `'X'` and `'O'`, _capture all regions that are 4-directionally surrounded by_ `'X'`.
5+
You are given an `m x n` matrix `board` containing **letters** `'X'` and `'O'`, **capture regions** that are **surrounded**:
66

7-
A region is **captured** by flipping all `'O'`s into `'X'`s in that surrounded region.
7+
* **Connect**: A cell is connected to adjacent cells horizontally or vertically.
8+
* **Region**: To form a region **connect every** `'O'` cell.
9+
* **Surround**: The region is surrounded with `'X'` cells if you can **connect the region** with `'X'` cells and none of the region cells are on the edge of the `board`.
810

9-
**Example 1:**
11+
To capture a **surrounded region**, replace all `'O'`s with `'X'`s **in-place** within the original board. You do not need to return anything.
1012

11-
![](https://assets.leetcode.com/uploads/2021/02/19/xogrid.jpg)
13+
**Example 1:**
1214

1315
**Input:** board = [["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]]
1416

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

17-
**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.
19+
**Explanation:**
20+
21+
![](https://assets.leetcode.com/uploads/2021/02/19/xogrid.jpg)
22+
23+
In the above diagram, the bottom region is not captured because it is on the edge of the board and cannot be surrounded.
1824

1925
**Example 2:**
2026

2127
**Input:** board = [["X"]]
2228

23-
**Output:** [["X"]]
29+
**Output:** [["X"]]
2430

2531
**Constraints:**
2632

src/main/java/g0101_0200/s0131_palindrome_partitioning/readme.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
Medium
44

5-
Given a string `s`, partition `s` such that every substring of the partition is a **palindrome**. Return all possible palindrome partitioning of `s`.
6-
7-
A **palindrome** string is a string that reads the same backward as forward.
5+
Given a string `s`, partition `s` such that every **substring** of the partition is a **palindrome**. Return _all possible palindrome partitioning of_ `s`.
86

97
**Example 1:**
108

0 commit comments

Comments
 (0)