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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Medium

You are given a **0-index****ed** string `street`. Each character in `street` is either `'H'` representing a house or `'.'` representing an empty space.
You are given a **0-indexed** string `street`. Each character in `street` is either `'H'` representing a house or `'.'` representing an empty space.

You can place buckets on the **empty spaces** to collect rainwater that falls from the adjacent houses. The rainwater from a house at index `i` is collected if a bucket is placed at index `i - 1` **and/or** index `i + 1`. A single bucket, if placed adjacent to two houses, can collect the rainwater from **both** houses.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hard

You are given a **1****\-indexed** array `nums` of `n` integers.
You are given a **1\-indexed** array `nums` of `n` integers.

A set of numbers is **complete** if the product of every pair of its elements is a perfect square.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We define the score of subarray `nums[l..r]` such that `l <= r` as `nums[l] AND

Consider splitting the array into one or more subarrays such that the following conditions are satisfied:

* **E****ach** element of the array belongs to **exactly** one subarray.
* **Each** element of the array belongs to **exactly** one subarray.
* The sum of scores of the subarrays is the **minimum** possible.

Return _the **maximum** number of subarrays in a split that satisfies the conditions above._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hard

You are given an integer array `nums` and two integers, `k` and `limit`. Your task is to find a non-empty ****subsequences**** of `nums` that:
You are given an integer array `nums` and two integers, `k` and `limit`. Your task is to find a non-empty **subsequences** of `nums` that:

* Has an **alternating sum** equal to `k`.
* **Maximizes** the product of all its numbers _without the product exceeding_ `limit`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Hard

You are given an **und****irected** graph of `n` nodes, numbered from `0` to `n - 1`. Each node is connected to **at most** 2 other nodes.
You are given an **undirected** graph of `n` nodes, numbered from `0` to `n - 1`. Each node is connected to **at most** 2 other nodes.

The graph consists of `m` edges, represented by a 2D array `edges`, where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that there is an edge between nodes <code>a<sub>i</sub></code> and <code>b<sub>i</sub></code>.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Medium

Given a string `s`, find the sum of the **3 largest unique prime numbers** that can be formed using any of its ****substring****.
Given a string `s`, find the sum of the **3 largest unique prime numbers** that can be formed using any of its **substring**.

Return the **sum** of the three largest unique prime numbers that can be formed. If fewer than three exist, return the sum of **all** available primes. If no prime numbers can be formed, return 0.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Medium

You are given a string `word`.

Return the **maximum** number of non-intersecting ****substring**** of word that are at **least** four characters long and start and end with the same letter.
Return the **maximum** number of non-intersecting **substring** of word that are at **least** four characters long and start and end with the same letter.

**Example 1:**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hard

You are given two strings, `word1` and `word2`, of equal length. You need to transform `word1` into `word2`.

For this, divide `word1` into one or more **contiguous **substring****. For each substring `substr` you can perform the following operations:
For this, divide `word1` into one or more **contiguous substring**. For each substring `substr` you can perform the following operations:

1. **Replace:** Replace the character at any one index of `substr` with another lowercase English letter.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Medium

You are given an integer array `nums` and an integer `m`.

Return the **maximum** product of the first and last elements of any ****subsequences**** of `nums` of size `m`.
Return the **maximum** product of the first and last elements of any **subsequences** of `nums` of size `m`.

**Example 1:**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Return an array `ans`, where `ans[j]` is the node index of the weighted median f

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

**E****xplanation:**
**Explanation:**

![](https://assets.leetcode.com/uploads/2025/05/26/screenshot-2025-05-26-at-193610.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Medium

You are given an integer array `nums` and an integer `k`.

Your task is to partition `nums` into `k` non-empty ****non-empty subarrays****. For each subarray, compute the bitwise **XOR** of all its elements.
Your task is to partition `nums` into `k` non-empty **non-empty subarrays**. For each subarray, compute the bitwise **XOR** of all its elements.

Return the **minimum** possible value of the **maximum XOR** among these `k` subarrays.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Return the **maximum** possible length of a **palindrome** that can be formed by

**Output:** 3

**Exp****lanation:**
**Explanation:**

![](https://assets.leetcode.com/uploads/2025/06/13/screenshot-2025-06-13-at-230714.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A **string** is **k-balanced** if it is **exactly** `k` **consecutive** `'('` fo

For example, if `k = 3`, k-balanced is `"((()))"`.

You must **repeatedly** remove all **non-overlapping k-balanced **substring**** from `s`, and then join the remaining parts. Continue this process until no k-balanced **substring** exists.
You must **repeatedly** remove all **non-overlapping k-balanced substring** from `s`, and then join the remaining parts. Continue this process until no k-balanced **substring** exists.

Return the final string after all possible removals.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hard

You are given an integer array `nums` **sorted** in **non-descending** order and a positive integer `k`.

A ****non-empty subarrays**** of `nums` is **good** if the sum of its elements is **divisible** by `k`.
A **non-empty subarrays** of `nums` is **good** if the sum of its elements is **divisible** by `k`.

Return an integer denoting the number of **distinct** **good** subarrays of `nums`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hard

You are given an integer array `nums`.

A ****non-empty subarrays**** of `nums` is called **stable** if it contains **no inversions**, i.e., there is no pair of indices `i < j` such that `nums[i] > nums[j]`.
A **non-empty subarrays** of `nums` is called **stable** if it contains **no inversions**, i.e., there is no pair of indices `i < j` such that `nums[i] > nums[j]`.

You are also given a **2D integer array** `queries` of length `q`, where each <code>queries[i] = [l<sub>i</sub>, r<sub>i</sub>]</code> represents a query. For each query <code>[l<sub>i</sub>, r<sub>i</sub>]</code>, compute the number of **stable subarrays** that lie entirely within the segment <code>nums[l<sub>i</sub>..r<sub>i</sub>]</code>.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Medium

Given an integer array `nums`, return the **length** of the **longest **non-empty subarrays**** that has a bitwise XOR of zero and contains an **equal** number of **even** and **odd** numbers. If no such subarray exists, return 0.
Given an integer array `nums`, return the **length** of the **longest non-empty subarrays** that has a bitwise XOR of zero and contains an **equal** number of **even** and **odd** numbers. If no such subarray exists, return 0.

**Example 1:**

Expand Down
Loading