Skip to content

Commit a514d4f

Browse files
authored
Updated tasks 73-102
1 parent 7876108 commit a514d4f

File tree

11 files changed

+43
-49
lines changed

11 files changed

+43
-49
lines changed

src/main/java/g0001_0100/s0073_set_matrix_zeroes/readme.md

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

33
Medium
44

5-
Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s, and return _the matrix_.
5+
Given an `m x n` integer matrix `matrix`, if an element is `0`, set its entire row and column to `0`'s.
66

77
You must do it [in place](https://en.wikipedia.org/wiki/In-place_algorithm).
88

src/main/java/g0001_0100/s0074_search_a_2d_matrix/readme.md

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

33
Medium
44

5-
Write an efficient algorithm that searches for a value in an `m x n` matrix. This matrix has the following properties:
5+
You are given an `m x n` integer matrix `matrix` with the following two properties:
66

7-
* Integers in each row are sorted from left to right.
7+
* Each row is sorted in non-decreasing order.
88
* The first integer of each row is greater than the last integer of the previous row.
99

10+
Given an integer `target`, return `true` _if_ `target` _is in_ `matrix` _or_ `false` _otherwise_.
11+
12+
You must write a solution in `O(log(m * n))` time complexity.
13+
1014
**Example 1:**
1115

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

src/main/java/g0001_0100/s0075_sort_colors/readme.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,11 @@ You must solve this problem without using the library's sort function.
2020

2121
**Output:** [0,1,2]
2222

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

3725
* `n == nums.length`
3826
* `1 <= n <= 300`
39-
* `nums[i]` is `0`, `1`, or `2`.
27+
* `nums[i]` is either `0`, `1`, or `2`.
4028

4129
**Follow up:** Could you come up with a one-pass algorithm using only constant extra space?
4230

src/main/java/g0001_0100/s0076_minimum_window_substring/readme.md

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

33
Hard
44

5-
Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window substring** of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window. If there is no such substring__, return the empty string_ `""`_._
5+
Given two strings `s` and `t` of lengths `m` and `n` respectively, return _the **minimum window**_ **substring** _of_ `s` _such that every character in_ `t` _(**including duplicates**) is included in the window_. If there is no such substring, return _the empty string_ `""`.
66

77
The testcases will be generated such that the answer is **unique**.
88

9-
A **substring** is a contiguous sequence of characters within the string.
10-
119
**Example 1:**
1210

1311
**Input:** s = "ADOBECODEBANC", t = "ABC"

src/main/java/g0001_0100/s0077_combinations/readme.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22

33
Medium
44

5-
Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers out of the range_ `[1, n]`.
5+
Given two integers `n` and `k`, return _all possible combinations of_ `k` _numbers chosen from the range_ `[1, n]`.
66

77
You may return the answer in **any order**.
88

99
**Example 1:**
1010

1111
**Input:** n = 4, k = 2
1212

13-
**Output:** [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ]
13+
**Output:** [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
14+
15+
**Explanation:** There are 4 choose 2 = 6 total combinations. Note that combinations are unordered, i.e., [1,2] and [2,1] are considered to be the same combination.
1416

1517
**Example 2:**
1618

1719
**Input:** n = 1, k = 1
1820

19-
**Output:** [[1]]
21+
**Output:** [[1]]
22+
23+
**Explanation:** There is 1 choose 1 = 1 total combination.
2024

2125
**Constraints:**
2226

src/main/java/g0001_0100/s0078_subsets/readme.md

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

33
Medium
44

5-
Given an integer array `nums` of **unique** elements, return _all possible subsets (the power set)_.
5+
Given an integer array `nums` of **unique** elements, return _all possible_ **subset** _(the power set)_.
66

77
The solution set **must not** contain duplicate subsets. Return the solution in **any order**.
88

src/main/java/g0001_0100/s0080_remove_duplicates_from_sorted_array_ii/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The judge will test your solution with the following code:
1818
int[] expectedNums = [...]; // The expected answer with correct length
1919

2020
int k = removeDuplicates(nums); // Calls your implementation
21-
21+
2222
assert k == expectedNums.length;
2323
for (int i = 0; i < k; i++) {
2424
assert nums[i] == expectedNums[i];
@@ -46,4 +46,4 @@ If all assertions pass, then your solution will be **accepted**.
4646

4747
* <code>1 <= nums.length <= 3 * 10<sup>4</sup></code>
4848
* <code>-10<sup>4</sup> <= nums[i] <= 10<sup>4</sup></code>
49-
* `nums` is sorted in **non-decreasing** order.
49+
* `nums` is sorted in **non-decreasing** order.

src/main/java/g0001_0100/s0088_merge_sorted_array/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The final sorted array should not be returned by the function, but instead be _s
1414

1515
**Output:** [1,2,2,3,5,6]
1616

17-
**Explanation:** The arrays we are merging are [1,2,3] and [2,5,6]. The result of the merge is [1,2,2,3,5,6] with the underlined elements coming from nums1.
17+
**Explanation:** The arrays we are merging are [1,2,3] and [2,5,6]. The result of the merge is [<ins>1</ins>,<ins>2</ins>,2,<ins>3</ins>,5,6] with the underlined elements coming from nums1.
1818

1919
**Example 2:**
2020

src/main/java/g0001_0100/s0094_binary_tree_inorder_traversal/readme.md

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,35 @@ Given the `root` of a binary tree, return _the inorder traversal of its nodes' v
66

77
**Example 1:**
88

9-
![](https://assets.leetcode.com/uploads/2020/09/15/inorder_1.jpg)
10-
119
**Input:** root = [1,null,2,3]
1210

13-
**Output:** [1,3,2]
14-
15-
**Example 2:**
11+
**Output:** [1,3,2]
1612

17-
**Input:** root = []
13+
**Explanation:**
1814

19-
**Output:** []
15+
![](https://assets.leetcode.com/uploads/2024/08/29/screenshot-2024-08-29-202743.png)
2016

21-
**Example 3:**
17+
**Example 2:**
2218

23-
**Input:** root = [1]
19+
**Input:** root = [1,2,3,4,5,null,8,null,null,6,7,9]
2420

25-
**Output:** [1]
21+
**Output:** [4,2,6,5,7,1,3,9,8]
2622

27-
**Example 4:**
23+
**Explanation:**
2824

29-
![](https://assets.leetcode.com/uploads/2020/09/15/inorder_5.jpg)
25+
![](https://assets.leetcode.com/uploads/2024/08/29/tree_2.png)
3026

31-
**Input:** root = [1,2]
27+
**Example 3:**
3228

33-
**Output:** [2,1]
29+
**Input:** root = []
3430

35-
**Example 5:**
31+
**Output:** []
3632

37-
![](https://assets.leetcode.com/uploads/2020/09/15/inorder_4.jpg)
33+
**Example 4:**
3834

39-
**Input:** root = [1,null,2]
35+
**Input:** root = [1]
4036

41-
**Output:** [1,2]
37+
**Output:** [1]
4238

4339
**Constraints:**
4440

src/main/java/g0001_0100/s0097_interleaving_string/readme.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Medium
44

55
Given strings `s1`, `s2`, and `s3`, find whether `s3` is formed by an **interleaving** of `s1` and `s2`.
66

7-
An **interleaving** of two strings `s` and `t` is a configuration where they are divided into **non-empty** substrings such that:
7+
An **interleaving** of two strings `s` and `t` is a configuration where `s` and `t` are divided into `n` and `m` **substring** respectively, such that:
88

99
* <code>s = s<sub>1</sub> + s<sub>2</sub> + ... + s<sub>n</sub></code>
1010
* <code>t = t<sub>1</sub> + t<sub>2</sub> + ... + t<sub>m</sub></code>
@@ -19,13 +19,17 @@ An **interleaving** of two strings `s` and `t` is a configuration where they are
1919

2020
**Input:** s1 = "aabcc", s2 = "dbbca", s3 = "aadbbcbcac"
2121

22-
**Output:** true
22+
**Output:** true
23+
24+
**Explanation:** One way to obtain s3 is: Split s1 into s1 = "aa" + "bc" + "c", and s2 into s2 = "dbbc" + "a". Interleaving the two splits, we get "aa" + "dbbc" + "bc" + "a" + "c" = "aadbbcbcac". Since s3 can be obtained by interleaving s1 and s2, we return true.
2325

2426
**Example 2:**
2527

2628
**Input:** s1 = "aabcc", s2 = "dbbca", s3 = "aadbbbaccc"
2729

28-
**Output:** false
30+
**Output:** false
31+
32+
**Explanation:** Notice how it is impossible to interleave s2 with any other string to obtain s3.
2933

3034
**Example 3:**
3135

0 commit comments

Comments
 (0)