Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update readme for tasks 219-300 #2073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
javadev merged 1 commit into javadev:main from ThanhNIT:tasks-219-300
Nov 2, 2025
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Easy

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`.
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`.

**Example 1:**

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
222\. Count Complete Tree Nodes

Medium
Easy

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

Expand Down
20 changes: 2 additions & 18 deletions src/main/java/g0201_0300/s0228_summary_ranges/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Easy

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

A **range** `[a,b]` is the set of all integers from `a` to `b` (inclusive).

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`.

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

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

**Example 3:**

**Input:** nums = []

**Output:** []

**Example 4:**

**Input:** nums = [-1]

**Output:** ["-1"]

**Example 5:**

**Input:** nums = [0]

**Output:** ["0"]

**Constraints:**

* `0 <= nums.length <= 20`
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Easy

Given the `head` of a singly linked list, return `true` if it is a palindrome.
Given the `head` of a singly linked list, return `true` _if it is a_ _palindrome_ _or_ `false` _otherwise_.

**Example 1:**

Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ You must write an algorithm that runs in `O(n)` time and without using the divis

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

**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.)
**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.)
18 changes: 0 additions & 18 deletions src/main/java/g0201_0300/s0239_sliding_window_maximum/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,6 @@ Return _the max sliding window_.

**Output:** [1]

**Example 3:**

**Input:** nums = [1,-1], k = 1

**Output:** [1,-1]

**Example 4:**

**Input:** nums = [9,11], k = 2

**Output:** [11]

**Example 5:**

**Input:** nums = [4,-2], k = 2

**Output:** [4]

**Constraints:**

* <code>1 <= nums.length <= 10<sup>5</sup></code>
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Medium

Write an efficient algorithm that searches for a `target` value in an `m x n` integer `matrix`. The `matrix` has the following properties:
Write an efficient algorithm that searches for a value `target` in an `m x n` integer matrix `matrix`. This matrix has the following properties:

* Integers in each row are sorted in ascending from left to right.
* Integers in each column are sorted in ascending from top to bottom.
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/g0201_0300/s0242_valid_anagram/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

Easy

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

**Example 1:**

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

**Output:** true
**Output:** true

**Example 2:**

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

**Output:** false
**Output:** false

**Constraints:**

Expand Down
13 changes: 4 additions & 9 deletions src/main/java/g0201_0300/s0274_h_index/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@

Medium

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**.
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_.

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.

If there are several possible values for `h`, the maximum one is taken as the `h`**\-index**.
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.

**Example 1:**

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

**Output:** 3

**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.
**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.

**Example 2:**

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

* `n == citations.length`
* `1 <= n <= 5000`
* `0 <= citations[i] <= 1000`
* `0 <= citations[i] <= 1000`
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Given an array of integers `nums` containing `n + 1` integers where each integer

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

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

**Example 1:**

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

**Example 3:**

**Input:** nums = [1,1]
**Input:** nums = [3,3,3,3,3]

**Output:** 1

**Example 4:**

**Input:** nums = [1,1,2]

**Output:** 1
**Output:** 3

**Constraints:**

Expand Down
10 changes: 7 additions & 3 deletions src/main/java/g0201_0300/s0289_game_of_life/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ The board is made up of an `m x n` grid of cells, where each cell has an initial
3. Any live cell with more than three live neighbors dies, as if by over-population.
4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

The next state is created by applying the above rules simultaneously to every cell in the current state, where births and deaths occur simultaneously. Given the current state of the `m x n` grid `board`, return _the next state_.
The next state of the board is determined by applying the above rules simultaneously to every cell in the current state of the `m x n` grid `board`. In this process, births and deaths occur **simultaneously**.

Given the current state of the `board`, **update** the `board` to reflect its next state.

**Note** that you do not need to return anything.

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/12/26/grid1.jpg)

**Input:** board = [[0,1,0],[0,0,1],[1,1,1],[0,0,0]]

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

**Example 2:**

![](https://assets.leetcode.com/uploads/2020/12/26/grid2.jpg)

**Input:** board = [[1,1],[1,0]]

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

**Constraints:**

Expand Down
27 changes: 16 additions & 11 deletions src/main/java/g0201_0300/s0290_word_pattern/readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,42 @@ Easy

Given a `pattern` and a string `s`, find if `s` follows the same pattern.

Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`.
Here **follow** means a full match, such that there is a bijection between a letter in `pattern` and a **non-empty** word in `s`. Specifically:

* Each letter in `pattern` maps to **exactly** one unique word in `s`.
* Each unique word in `s` maps to **exactly** one letter in `pattern`.
* No two letters map to the same word, and no two words map to the same letter.

**Example 1:**

**Input:** pattern = "abba", s = "dog cat cat dog"

**Output:** true
**Output:** true

**Explanation:**

The bijection can be established as:

* `'a'` maps to `"dog"`.
* `'b'` maps to `"cat"`.

**Example 2:**

**Input:** pattern = "abba", s = "dog cat cat fish"

**Output:** false
**Output:** false

**Example 3:**

**Input:** pattern = "aaaa", s = "dog cat cat dog"

**Output:** false

**Example 4:**

**Input:** pattern = "abba", s = "dog dog dog dog"

**Output:** false
**Output:** false

**Constraints:**

* `1 <= pattern.length <= 300`
* `pattern` contains only lower-case English letters.
* `1 <= s.length <= 3000`
* `s` contains only lower-case English letters and spaces `' '`.
* `s` contains only lowercase English letters and spaces `' '`.
* `s` **does not contain** any leading or trailing spaces.
* All the words in `s` are separated by a **single space**.
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hard

The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value and the median is the mean of the two middle values.
The **median** is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values.

* For example, for `arr = [2,3,4]`, the median is `3`.
* For example, for `arr = [2,3]`, the median is `(2 + 3) / 2 = 2.5`.
Expand Down
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

Medium

Given an integer array `nums`, return the length of the longest strictly increasing subsequence.

A **subsequence** is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, `[3,6,2,7]` is a subsequence of the array `[0,3,1,6,2,2,7]`.
Given an integer array `nums`, return _the length of the longest **strictly increasing**_ **subsequences**.

**Example 1:**

Expand Down

AltStyle によって変換されたページ (->オリジナル) /