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 @@ -16,7 +16,7 @@ A sequence of length 1 is considered alternating.

Return the **maximum** possible element that can appear in any valid sequence.

OriginalJava**Example 1:**
**Example 1:**

**Input:** n = 4, s = 3, m = 5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In one **adjacent swap**, you may swap two **neighboring** elements of `nums`.

Return the **minimum number** of adjacent swaps required to make `nums` good. Since the answer may be very large, return it **modulo** <code>10<sup>9</sup> + 7</code>.

OriginalJava**Example 1:**
**Example 1:**

**Input:** nums = [1,3,2,4,5,6], a = 3, b = 4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Since every <code>pattern<sub>i</sub></code> and <code>replacement<sub>i</sub></

Return the **minimum** total cost required to transform `source` into `target`. If it is impossible, return -1.

OriginalJava**Example 1:**
**Example 1:**

**Input:** source = "hello", target = "world", rules = [["he","wo"],["llo","rld"]], costs = [3,4]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Return `true` if a knight can move from `start` to `target` in an **even** numbe

![](https://assets.leetcode.com/uploads/2018/10/12/knight.png)

OriginalJava**Example 1:**
**Example 1:**

**Input:** start = [1,1], target = [2,2]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You may perform the following operation any number of times (including zero):

Return a boolean array `ans`, where `ans[i]` is `true` if it's possible to replace all `'?'` in `strs[i]` with `'0'` or `'1'` and transform `s` into the resulting string using the allowed operation above, otherwise return `false`.

OriginalJava**Example 1:**
**Example 1:**

**Input:** s = "101", strs = ["1?1","0?1","0?0"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Partition `words` into the **minimum** number of groups such that:

Return an integer denoting the **minimum** number of groups.

OriginalJava**Example 1:**
**Example 1:**

**Input:** words = ["ntgwz","zwntg"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You are given two non-negative integers `n` and `s`.

Return the **largest** integer that has **at most** `n` digits and whose sum of digits is `s`. If no such integer exists, return -1.

OriginalJava**Example 1:**
**Example 1:**

**Input:** n = 2, s = 9

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The **aggregated series** is formed by summing the corresponding values from bot

Return the **aggregated series** as a 2D integer array of `[timestamp, summedValue]` pairs, sorted in **strictly increasing** order of timestamp.

OriginalJava**Example 1:**
**Example 1:**

**Input:** series1 = [[1,3],[4,1]], series2 = [[2,2],[5,2]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Return the number of valid sequences. Since the answer may be very large, return

Two sequences are considered **different** if they differ at any index. For example, `[1, 1, 2]` and `[1, 2, 1]` are considered different sequences.

OriginalJava**Example 1:**
**Example 1:**

**Input:** n = 5, k = 3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ After every move or wait, the action number increases by 1. Therefore, the requi

Return the **minimum** total cost required to reach `(m - 1, n - 1)`.

OriginalJava**Example 1:**
**Example 1:**

**Input:** m = 2, n = 2, penalty = [[5,3],[1,4]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Return the number of valid prefixes of `s`.

A string is considered **alternating** if no two adjacent characters are equal.

OriginalJava**Example 1:**
**Example 1:**

**Input:** s = "00101"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You may either use a plank as is, or combine **exactly** two distinct original p

Return the **maximum possible width** of the fence that can be built.

OriginalJava**Example 1:**
**Example 1:**

**Input:** planks = [1,3,2,5,7,5,4,2,1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Return the **minimum** initial strength required to defeat all monsters.

Note: The temporary bonus is used only to determine whether the current monster can be defeated. It does not otherwise change your current strength.

OriginalJava**Example 1:**
**Example 1:**

**Input:** monsters = [5,10,15], boosts = [[1,1,10]]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The **waiting time** of a car is the time between when it becomes allowed to sta

Return the **minimum** possible value of the **maximum** waiting time among all served cars over all assignments that **maximize** the number of served cars. If no car can be served, return -1.

OriginalJava**Example 1:**
**Example 1:**

**Input:** demand = [6,8,4,6,5], fuel = [16,13]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Choose exactly one pair of distinct indices `i` and `j`. The strength of the pai

Return the maximum strength over all possible pairs.

OriginalJava**Example 1:**
**Example 1:**

**Input:** nums = [2,3,5]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A subarray is considered **valid** if:

Return the number of valid subarrays in `nums`.

OriginalJava**Example 1:**
**Example 1:**

**Input:** nums = [1,2,1,2], a = 3, b = 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A task is **unfinished** if it has not been fully completed. This includes a tas

Return an integer array `ans` where `ans[j]` is the number of **unfinished** tasks immediately after the <code>j<sup>th</sup></code> shift.

OriginalJava**Example 1:**
**Example 1:**

**Input:** tasks = [1,4,4], shifts = [9,1,4]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A subarray is considered **valid** if:

Return the number of valid subarrays in `nums`.

OriginalJava**Example 1:**
**Example 1:**

**Input:** nums = [1,2,1,2], a = 3, b = 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If a discount of `d` percent is applied to an item with price `p`, its final pri

Return the **minimum** possible sum of final prices after assigning discounts optimally. Answers within <code>10<sup>-5</sup></code> of the actual answer will be accepted.

OriginalJava**Example 1:**
**Example 1:**

**Input:** prices = [10,30,21], discounts = [50,60]

Expand Down
Loading