Skip to content

Commit 9cb2f50

Browse files
authored
Updated asks 219-300
1 parent e1aabc9 commit 9cb2f50

File tree

14 files changed

+43
-81
lines changed

14 files changed

+43
-81
lines changed

src/main/java/g0201_0300/s0219_contains_duplicate_ii/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-
Given an integer array `nums` and an integer `k`, return `true` if there are two **distinct indices** `i` and `j` in the array such that `nums[i] == nums[j]` and `abs(i - j) <= k`.
5+
Given an integer array `nums` and an integer `k`, return `true` _if there are two **distinct indices**_ `i` _and_ `j` _in the array such that_ `nums[i] == nums[j]` _and_ `abs(i - j) <= k`.
66

77
**Example 1:**
88

src/main/java/g0201_0300/s0222_count_complete_tree_nodes/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
222\. Count Complete Tree Nodes
22

3-
Medium
3+
Easy
44

55
Given the `root` of a **complete** binary tree, return the number of the nodes in the tree.
66

src/main/java/g0201_0300/s0228_summary_ranges/readme.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Easy
44

55
You are given a **sorted unique** integer array `nums`.
66

7+
A **range** `[a,b]` is the set of all integers from `a` to `b` (inclusive).
8+
79
Return _the **smallest sorted** list of ranges that **cover all the numbers in the array exactly**_. That is, each element of `nums` is covered by exactly one of the ranges, and there is no integer `x` such that `x` is in one of the ranges but not in `nums`.
810

911
Each range `[a,b]` in the list should be output as:
@@ -27,24 +29,6 @@ Each range `[a,b]` in the list should be output as:
2729

2830
**Explanation:** The ranges are: [0,0] --> "0" [2,4] --> "2->4" [6,6] --> "6" [8,9] --> "8->9"
2931

30-
**Example 3:**
31-
32-
**Input:** nums = []
33-
34-
**Output:** []
35-
36-
**Example 4:**
37-
38-
**Input:** nums = [-1]
39-
40-
**Output:** ["-1"]
41-
42-
**Example 5:**
43-
44-
**Input:** nums = [0]
45-
46-
**Output:** ["0"]
47-
4832
**Constraints:**
4933

5034
* `0 <= nums.length <= 20`

src/main/java/g0201_0300/s0234_palindrome_linked_list/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-
Given the `head` of a singly linked list, return `true` if it is a palindrome.
5+
Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_.
66

77
**Example 1:**
88

src/main/java/g0201_0300/s0238_product_of_array_except_self/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ You must write an algorithm that runs in `O(n)` time and without using the divis
2424

2525
* <code>2 <= nums.length <= 10<sup>5</sup></code>
2626
* `-30 <= nums[i] <= 30`
27-
* The product of any prefix or suffix of `nums` is **guaranteed** to fit in a **32-bit** integer.
27+
* The input is generated such that `answer[i]` is **guaranteed** to fit in a **32-bit** integer.
2828

29-
**Follow up:** Can you solve the problem in `O(1) `extra space complexity? (The output array **does not** count as extra space for space complexity analysis.)
29+
**Follow up:** Can you solve the problem in `O(1)` extra space complexity? (The output array **does not** count as extra space for space complexity analysis.)

src/main/java/g0201_0300/s0239_sliding_window_maximum/readme.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@ Return _the max sliding window_.
2929

3030
**Output:** [1]
3131

32-
**Example 3:**
33-
34-
**Input:** nums = [1,-1], k = 1
35-
36-
**Output:** [1,-1]
37-
38-
**Example 4:**
39-
40-
**Input:** nums = [9,11], k = 2
41-
42-
**Output:** [11]
43-
44-
**Example 5:**
45-
46-
**Input:** nums = [4,-2], k = 2
47-
48-
**Output:** [4]
49-
5032
**Constraints:**
5133

5234
* <code>1 <= nums.length <= 10<sup>5</sup></code>

src/main/java/g0201_0300/s0240_search_a_2d_matrix_ii/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-
Write an efficient algorithm that searches for a `target` value in an `m x n` integer `matrix`. The `matrix` has the following properties:
5+
Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:
66

77
* Integers in each row are sorted in ascending from left to right.
88
* Integers in each column are sorted in ascending from top to bottom.

src/main/java/g0201_0300/s0242_valid_anagram/readme.md

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

33
Easy
44

5-
Given two strings `s` and `t`, return `true` _if_ `t` _is an anagram of_ `s`_, and_ `false` _otherwise_.
5+
Given two strings `s` and `t`, return `true` if `t` is an anagram of `s`, and `false` otherwise.
66

77
**Example 1:**
88

99
**Input:** s = "anagram", t = "nagaram"
1010

11-
**Output:** true
11+
**Output:** true
1212

1313
**Example 2:**
1414

1515
**Input:** s = "rat", t = "car"
1616

17-
**Output:** false
17+
**Output:** false
1818

1919
**Constraints:**
2020

src/main/java/g0201_0300/s0274_h_index/readme.md

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

33
Medium
44

5-
Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their <code>i<sup>th</sup></code> paper, return compute the researcher's `h`**\-index**.
5+
Given an array of integers `citations` where `citations[i]` is the number of citations a researcher received for their <code>i<sup>th</sup></code> paper, return _the researcher's h-index_.
66

7-
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): A scientist has an index `h` if `h` of their `n` papers have at least `h` citations each, and the other `n − h` papers have no more than `h` citations each.
8-
9-
If there are several possible values for `h`, the maximum one is taken as the `h`**\-index**.
7+
According to the [definition of h-index on Wikipedia](https://en.wikipedia.org/wiki/H-index): The h-index is defined as the maximum value of `h` such that the given researcher has published at least `h` papers that have each been cited at least `h` times.
108

119
**Example 1:**
1210

1311
**Input:** citations = [3,0,6,1,5]
1412

1513
**Output:** 3
1614

17-
**Explanation:**
18-
19-
[3,0,6,1,5] means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively.
20-
Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, their h-index is 3.
15+
**Explanation:** [3,0,6,1,5] means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, their h-index is 3.
2116

2217
**Example 2:**
2318

@@ -29,4 +24,4 @@ If there are several possible values for `h`, the maximum one is taken as the `h
2924

3025
* `n == citations.length`
3126
* `1 <= n <= 5000`
32-
* `0 <= citations[i] <= 1000`
27+
* `0 <= citations[i] <= 1000`

src/main/java/g0201_0300/s0287_find_the_duplicate_number/readme.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Given an array of integers `nums` containing `n + 1` integers where each integer
66

77
There is only **one repeated number** in `nums`, return _this repeated number_.
88

9-
You must solve the problem **without** modifying the array `nums` and uses only constant extra space.
9+
You must solve the problem **without** modifying the array `nums` and using only constant extra space.
1010

1111
**Example 1:**
1212

@@ -22,15 +22,9 @@ You must solve the problem **without** modifying the array `nums` and uses only
2222

2323
**Example 3:**
2424

25-
**Input:** nums = [1,1]
25+
**Input:** nums = [3,3,3,3,3]
2626

27-
**Output:** 1
28-
29-
**Example 4:**
30-
31-
**Input:** nums = [1,1,2]
32-
33-
**Output:** 1
27+
**Output:** 3
3428

3529
**Constraints:**
3630

0 commit comments

Comments
 (0)