bowang0911/leetcode huggingface dataset:
The Latest Time to Catch a Bus

You are given a **0-indexed** integer array `buses` of length `n`, where `buses[i]` represents the departure time of the `ith` bus. You are also given a **0-indexed** integer array `passengers` of length `m`, where `passengers[j]` represents the arrival time of the `jth` passenger. All bus departure times are unique. All passenger arrival times are unique.

You are given an integer `capacity`, which represents the **maximum** number of passengers that can get on each bus.

When a passenger arrives, they will wait in line for the next available bus. You can get on a bus that departs at `x` minutes if you arrive at `y` minutes where `y <= x`, and the bus is not full. Passengers with the **earliest** arrival times get on the bus first.

More formally when a bus arrives, either:

*   If `capacity` or fewer passengers are waiting for a bus, they will **all** get on the bus, or
*   The `capacity` passengers with the **earliest** arrival times will get on the bus.

Return _the latest time you may arrive at the bus station to catch a bus_. You **cannot** arrive at the same time as another passenger.

**Note:** The arrays `buses` and `passengers` are not necessarily sorted.

**Example 1:**

**Input:** buses = \[10,20\], passengers = \[2,17,18,19\], capacity = 2
**Output:** 16
**Explanation:** Suppose you arrive at time 16.
At time 10, the first bus departs with the 0th passenger. 
At time 20, the second bus departs with you and the 1st passenger.
Note that you may not arrive at the same time as another passenger, which is why you must arrive before the 1st passenger to catch the bus.

**Example 2:**

**Input:** buses = \[20,30,10\], passengers = \[19,13,26,4,25,11,21\], capacity = 2
**Output:** 20
**Explanation:** Suppose you arrive at time 20.
At time 10, the first bus departs with the 3rd passenger. 
At time 20, the second bus departs with the 5th and 1st passengers.
At time 30, the third bus departs with the 0th passenger and you.
Notice if you had arrived any later, then the 6th passenger would have taken your seat on the third bus.

**Constraints:**

*   `n == buses.length`
*   `m == passengers.length`
*   `1 <= n, m, capacity <= 105`
*   `2 <= buses[i], passengers[i] <= 109`
*   Each element in `buses` is **unique**.
*   Each element in `passengers` is **unique**.
Minimum Sum of Squared Difference

You are given two positive **0-indexed** integer arrays `nums1` and `nums2`, both of length `n`.

The **sum of squared difference** of arrays `nums1` and `nums2` is defined as the **sum** of `(nums1[i] - nums2[i])2` for each `0 <= i < n`.

You are also given two positive integers `k1` and `k2`. You can modify any of the elements of `nums1` by `+1` or `-1` at most `k1` times. Similarly, you can modify any of the elements of `nums2` by `+1` or `-1` at most `k2` times.

Return _the minimum **sum of squared difference** after modifying array_ `nums1` _at most_ `k1` _times and modifying array_ `nums2` _at most_ `k2` _times_.

**Note**: You are allowed to modify the array elements to become **negative** integers.

**Example 1:**

**Input:** nums1 = \[1,2,3,4\], nums2 = \[2,10,20,19\], k1 = 0, k2 = 0
**Output:** 579
**Explanation:** The elements in nums1 and nums2 cannot be modified because k1 = 0 and k2 = 0. 
The sum of square difference will be: (1 - 2)2 \+ (2 - 10)2 \+ (3 - 20)2 \+ (4 - 19)2 = 579.

**Example 2:**

**Input:** nums1 = \[1,4,10,12\], nums2 = \[5,8,6,9\], k1 = 1, k2 = 1
**Output:** 43
**Explanation:** One way to obtain the minimum sum of square difference is: 
- Increase nums1\[0\] once.
- Increase nums2\[2\] once.
The minimum of the sum of square difference will be: 
(2 - 5)2 \+ (4 - 8)2 \+ (10 - 7)2 \+ (12 - 9)2 = 43.
Note that, there are other ways to obtain the minimum of the sum of square difference, but there is no way to obtain a sum smaller than 43.

**Constraints:**

*   `n == nums1.length == nums2.length`
*   `1 <= n <= 105`
*   `0 <= nums1[i], nums2[i] <= 105`
*   `0 <= k1, k2 <= 109`
Subarray With Elements Greater Than Varying Threshold

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

Find any subarray of `nums` of length `k` such that **every** element in the subarray is **greater** than `threshold / k`.

Return _the **size** of **any** such subarray_. If there is no such subarray, return `-1`.

A **subarray** is a contiguous non-empty sequence of elements within an array.

**Example 1:**

**Input:** nums = \[1,3,4,3,1\], threshold = 6
**Output:** 3
**Explanation:** The subarray \[3,4,3\] has a size of 3, and every element is greater than 6 / 3 = 2.
Note that this is the only valid subarray.

**Example 2:**

**Input:** nums = \[6,5,6,5,8\], threshold = 7
**Output:** 1
**Explanation:** The subarray \[8\] has a size of 1, and 8 > 7 / 1 = 7. So 1 is returned.
Note that the subarray \[6,5\] has a size of 2, and every element is greater than 7 / 2 = 3.5. 
Similarly, the subarrays \[6,5,6\], \[6,5,6,5\], \[6,5,6,5,8\] also satisfy the given conditions.
Therefore, 2, 3, 4, or 5 may also be returned.

**Constraints:**

*   `1 <= nums.length <= 105`
*   `1 <= nums[i], threshold <= 109`
Minimum Amount of Time to Fill Cups

You have a water dispenser that can dispense cold, warm, and hot water. Every second, you can either fill up `2` cups with **different** types of water, or `1` cup of any type of water.

You are given a **0-indexed** integer array `amount` of length `3` where `amount[0]`, `amount[1]`, and `amount[2]` denote the number of cold, warm, and hot water cups you need to fill respectively. Return _the **minimum** number of seconds needed to fill up all the cups_.

**Example 1:**

**Input:** amount = \[1,4,2\]
**Output:** 4
**Explanation:** One way to fill up the cups is:
Second 1: Fill up a cold cup and a warm cup.
Second 2: Fill up a warm cup and a hot cup.
Second 3: Fill up a warm cup and a hot cup.
Second 4: Fill up a warm cup.
It can be proven that 4 is the minimum number of seconds needed.

**Example 2:**

**Input:** amount = \[5,4,4\]
**Output:** 7
**Explanation:** One way to fill up the cups is:
Second 1: Fill up a cold cup, and a hot cup.
Second 2: Fill up a cold cup, and a warm cup.
Second 3: Fill up a cold cup, and a warm cup.
Second 4: Fill up a warm cup, and a hot cup.
Second 5: Fill up a cold cup, and a hot cup.
Second 6: Fill up a cold cup, and a warm cup.
Second 7: Fill up a hot cup.

**Example 3:**

**Input:** amount = \[5,0,0\]
**Output:** 5
**Explanation:** Every second, we fill up a cold cup.

**Constraints:**

*   `amount.length == 3`
*   `0 <= amount[i] <= 100`
Smallest Number in Infinite Set

You have a set which contains all positive integers `[1, 2, 3, 4, 5, ...]`.

Implement the `SmallestInfiniteSet` class:

*   `SmallestInfiniteSet()` Initializes the **SmallestInfiniteSet** object to contain **all** positive integers.
*   `int popSmallest()` **Removes** and returns the smallest integer contained in the infinite set.
*   `void addBack(int num)` **Adds** a positive integer `num` back into the infinite set, if it is **not** already in the infinite set.

**Example 1:**

**Input**
\[ "SmallestInfiniteSet ",  "addBack ",  "popSmallest ",  "popSmallest ",  "popSmallest ",  "addBack ",  "popSmallest ",  "popSmallest ",  "popSmallest "\]
\[\[\], \[2\], \[\], \[\], \[\], \[1\], \[\], \[\], \[\]\]
**Output**
\[null, null, 1, 2, 3, null, 1, 4, 5\]

**Explanation**
SmallestInfiniteSet smallestInfiniteSet = new SmallestInfiniteSet();
smallestInfiniteSet.addBack(2);    // 2 is already in the set, so no change is made.
smallestInfiniteSet.popSmallest(); // return 1, since 1 is the smallest number, and remove it from the set.
smallestInfiniteSet.popSmallest(); // return 2, and remove it from the set.
smallestInfiniteSet.popSmallest(); // return 3, and remove it from the set.
smallestInfiniteSet.addBack(1);    // 1 is added back to the set.
smallestInfiniteSet.popSmallest(); // return 1, since 1 was added back to the set and
                                   // is the smallest number, and remove it from the set.
smallestInfiniteSet.popSmallest(); // return 4, and remove it from the set.
smallestInfiniteSet.popSmallest(); // return 5, and remove it from the set.

**Constraints:**

*   `1 <= num <= 1000`
*   At most `1000` calls will be made **in total** to `popSmallest` and `addBack`.
Move Pieces to Obtain a String

You are given two strings `start` and `target`, both of length `n`. Each string consists **only** of the characters `'L'`, `'R'`, and `'_'` where:

*   The characters `'L'` and `'R'` represent pieces, where a piece `'L'` can move to the **left** only if there is a **blank** space directly to its left, and a piece `'R'` can move to the **right** only if there is a **blank** space directly to its right.
*   The character `'_'` represents a blank space that can be occupied by **any** of the `'L'` or `'R'` pieces.

Return `true` _if it is possible to obtain the string_ `target` _by moving the pieces of the string_ `start` _**any** number of times_. Otherwise, return `false`.

**Example 1:**

**Input:** start =  "\_L\_\_R\_\_R\_ ", target =  "L\_\_\_\_\_\_RR "
**Output:** true
**Explanation:** We can obtain the string target from start by doing the following moves:
- Move the first piece one step to the left, start becomes equal to  "**L**\_\_\_R\_\_R\_ ".
- Move the last piece one step to the right, start becomes equal to  "L\_\_\_R\_\_\_**R** ".
- Move the second piece three steps to the right, start becomes equal to  "L\_\_\_\_\_\_**R**R ".
Since it is possible to get the string target from start, we return true.

**Example 2:**

**Input:** start =  "R\_L\_ ", target =  "\_\_LR "
**Output:** false
**Explanation:** The 'R' piece in the string start can move one step to the right to obtain  "\_**R**L\_ ".
After that, no pieces can move anymore, so it is impossible to obtain the string target from start.

**Example 3:**

**Input:** start =  "\_R ", target =  "R\_ "
**Output:** false
**Explanation:** The piece in the string start can move only to the right, so it is impossible to obtain the string target from start.

**Constraints:**

*   `n == start.length == target.length`
*   `1 <= n <= 105`
*   `start` and `target` consist of the characters `'L'`, `'R'`, and `'_'`.
Count the Number of Ideal Arrays

You are given two integers `n` and `maxValue`, which are used to describe an **ideal** array.

A **0-indexed** integer array `arr` of length `n` is considered **ideal** if the following conditions hold:

*   Every `arr[i]` is a value from `1` to `maxValue`, for `0 <= i < n`.
*   Every `arr[i]` is divisible by `arr[i - 1]`, for `0 < i < n`.

Return _the number of **distinct** ideal arrays of length_ `n`. Since the answer may be very large, return it modulo `109 + 7`.

**Example 1:**

**Input:** n = 2, maxValue = 5
**Output:** 10
**Explanation:** The following are the possible ideal arrays:
- Arrays starting with the value 1 (5 arrays): \[1,1\], \[1,2\], \[1,3\], \[1,4\], \[1,5\]
- Arrays starting with the value 2 (2 arrays): \[2,2\], \[2,4\]
- Arrays starting with the value 3 (1 array): \[3,3\]
- Arrays starting with the value 4 (1 array): \[4,4\]
- Arrays starting with the value 5 (1 array): \[5,5\]
There are a total of 5 + 2 + 1 + 1 + 1 = 10 distinct ideal arrays.

**Example 2:**

**Input:** n = 5, maxValue = 3
**Output:** 11
**Explanation:** The following are the possible ideal arrays:
- Arrays starting with the value 1 (9 arrays): 
   - With no other distinct values (1 array): \[1,1,1,1,1\] 
   - With 2nd distinct value 2 (4 arrays): \[1,1,1,1,2\], \[1,1,1,2,2\], \[1,1,2,2,2\], \[1,2,2,2,2\]
   - With 2nd distinct value 3 (4 arrays): \[1,1,1,1,3\], \[1,1,1,3,3\], \[1,1,3,3,3\], \[1,3,3,3,3\]
- Arrays starting with the value 2 (1 array): \[2,2,2,2,2\]
- Arrays starting with the value 3 (1 array): \[3,3,3,3,3\]
There are a total of 9 + 1 + 1 = 11 distinct ideal arrays.

**Constraints:**

*   `2 <= n <= 104`
*   `1 <= maxValue <= 104`
Minimum Adjacent Swaps to Make a Valid Array

You are given a **0-indexed** integer array `nums`.

**Swaps** of **adjacent** elements are able to be performed on `nums`.

A **valid** array meets the following conditions:

*   The largest element (any of the largest elements if there are multiple) is at the rightmost position in the array.
*   The smallest element (any of the smallest elements if there are multiple) is at the leftmost position in the array.

Return _the **minimum** swaps required to make_ `nums` _a valid array_.

**Example 1:**

**Input:** nums = \[3,4,5,5,3,1\]
**Output:** 6
**Explanation:** Perform the following swaps:
- Swap 1: Swap the 3rd and 4th elements, nums is then \[3,4,5,**3**,**5**,1\].
- Swap 2: Swap the 4th and 5th elements, nums is then \[3,4,5,3,**1**,**5**\].
- Swap 3: Swap the 3rd and 4th elements, nums is then \[3,4,5,**1**,**3**,5\].
- Swap 4: Swap the 2nd and 3rd elements, nums is then \[3,4,**1**,**5**,3,5\].
- Swap 5: Swap the 1st and 2nd elements, nums is then \[3,**1**,**4**,5,3,5\].
- Swap 6: Swap the 0th and 1st elements, nums is then \[**1**,**3**,4,5,3,5\].
It can be shown that 6 swaps is the minimum swaps required to make a valid array.

**Example 2:**

**Input:** nums = \[9\]
**Output:** 0
**Explanation:** The array is already valid, so we return 0.

**Constraints:**

*   `1 <= nums.length <= 105`
*   `1 <= nums[i] <= 105`
Maximum Number of Pairs in Array

You are given a **0-indexed** integer array `nums`. In one operation, you may do the following:

*   Choose **two** integers in `nums` that are **equal**.
*   Remove both integers from `nums`, forming a **pair**.

The operation is done on `nums` as many times as possible.

Return _a **0-indexed** integer array_ `answer` _of size_ `2` _where_ `answer[0]` _is the number of pairs that are formed and_ `answer[1]` _is the number of leftover integers in_ `nums` _after doing the operation as many times as possible_.

**Example 1:**

**Input:** nums = \[1,3,2,1,3,2,2\]
**Output:** \[3,1\]
**Explanation:**
Form a pair with nums\[0\] and nums\[3\] and remove them from nums. Now, nums = \[3,2,3,2,2\].
Form a pair with nums\[0\] and nums\[2\] and remove them from nums. Now, nums = \[2,2,2\].
Form a pair with nums\[0\] and nums\[1\] and remove them from nums. Now, nums = \[2\].
No more pairs can be formed. A total of 3 pairs have been formed, and there is 1 number leftover in nums.

**Example 2:**

**Input:** nums = \[1,1\]
**Output:** \[1,0\]
**Explanation:** Form a pair with nums\[0\] and nums\[1\] and remove them from nums. Now, nums = \[\].
No more pairs can be formed. A total of 1 pair has been formed, and there are 0 numbers leftover in nums.

**Example 3:**

**Input:** nums = \[0\]
**Output:** \[0,1\]
**Explanation:** No pairs can be formed, and there is 1 number leftover in nums.

**Constraints:**

*   `1 <= nums.length <= 100`
*   `0 <= nums[i] <= 100`
Max Sum of a Pair With Equal Sum of Digits

You are given a **0-indexed** array `nums` consisting of **positive** integers. You can choose two indices `i` and `j`, such that `i != j`, and the sum of digits of the number `nums[i]` is equal to that of `nums[j]`.

Return _the **maximum** value of_ `nums[i] + nums[j]` _that you can obtain over all possible indices_ `i` _and_ `j` _that satisfy the conditions._

**Example 1:**

**Input:** nums = \[18,43,36,13,7\]
**Output:** 54
**Explanation:** The pairs (i, j) that satisfy the conditions are:
- (0, 2), both numbers have a sum of digits equal to 9, and their sum is 18 + 36 = 54.
- (1, 4), both numbers have a sum of digits equal to 7, and their sum is 43 + 7 = 50.
So the maximum sum that we can obtain is 54.

**Example 2:**

**Input:** nums = \[10,12,19,14\]
**Output:** -1
**Explanation:** There are no two numbers that satisfy the conditions, so we return -1.

**Constraints:**

*   `1 <= nums.length <= 105`
*   `1 <= nums[i] <= 109`
Query Kth Smallest Trimmed Number

You are given a **0-indexed** array of strings `nums`, where each string is of **equal length** and consists of only digits.

You are also given a **0-indexed** 2D integer array `queries` where `queries[i] = [ki, trimi]`. For each `queries[i]`, you need to:

*   **Trim** each number in `nums` to its **rightmost** `trimi` digits.
*   Determine the **index** of the `kith` smallest trimmed number in `nums`. If two trimmed numbers are equal, the number with the **lower** index is considered to be smaller.
*   Reset each number in `nums` to its original length.

Return _an array_ `answer` _of the same length as_ `queries`, _where_ `answer[i]` _is the answer to the_ `ith` _query._

**Note**:

*   To trim to the rightmost `x` digits means to keep removing the leftmost digit, until only `x` digits remain.
*   Strings in `nums` may contain leading zeros.

**Example 1:**

**Input:** nums = \[ "102 ", "473 ", "251 ", "814 "\], queries = \[\[1,1\],\[2,3\],\[4,2\],\[1,2\]\]
**Output:** \[2,2,1,0\]
**Explanation:**
1. After trimming to the last digit, nums = \[ "2 ", "3 ", "1 ", "4 "\]. The smallest number is 1 at index 2.
2. Trimmed to the last 3 digits, nums is unchanged. The 2nd smallest number is 251 at index 2.
3. Trimmed to the last 2 digits, nums = \[ "02 ", "73 ", "51 ", "14 "\]. The 4th smallest number is 73.
4. Trimmed to the last 2 digits, the smallest number is 2 at index 0.
   Note that the trimmed number  "02 " is evaluated as 2.

**Example 2:**

**Input:** nums = \[ "24 ", "37 ", "96 ", "04 "\], queries = \[\[2,1\],\[2,2\]\]
**Output:** \[3,0\]
**Explanation:**
1. Trimmed to the last digit, nums = \[ "4 ", "7 ", "6 ", "4 "\]. The 2nd smallest number is 4 at index 3.
   There are two occurrences of 4, but the one at index 0 is considered smaller than the one at index 3.
2. Trimmed to the last 2 digits, nums is unchanged. The 2nd smallest number is 24.

**Constraints:**

*   `1 <= nums.length <= 100`
*   `1 <= nums[i].length <= 100`
*   `nums[i]` consists of only digits.
*   All `nums[i].length` are **equal**.
*   `1 <= queries.length <= 100`
*   `queries[i].length == 2`
*   `1 <= ki <= nums.length`
*   `1 <= trimi <= nums[i].length`

**Follow up:** Could you use the **Radix Sort Algorithm** to solve this problem? What will be the complexity of that solution?
Minimum Deletions to Make Array Divisible

You are given two positive integer arrays `nums` and `numsDivide`. You can delete any number of elements from `nums`.

Return _the **minimum** number of deletions such that the **smallest** element in_ `nums` _**divides** all the elements of_ `numsDivide`. If this is not possible, return `-1`.

Note that an integer `x` divides `y` if `y % x == 0`.

**Example 1:**

**Input:** nums = \[2,3,2,4,3\], numsDivide = \[9,6,9,3,15\]
**Output:** 2
**Explanation:** 
The smallest element in \[2,3,2,4,3\] is 2, which does not divide all the elements of numsDivide.
We use 2 deletions to delete the elements in nums that are equal to 2 which makes nums = \[3,4,3\].
The smallest element in \[3,4,3\] is 3, which divides all the elements of numsDivide.
It can be shown that 2 is the minimum number of deletions needed.

**Example 2:**

**Input:** nums = \[4,3,6\], numsDivide = \[8,2,6,10\]
**Output:** -1
**Explanation:** 
We want the smallest element in nums to divide all the elements of numsDivide.
There is no way to delete elements from nums to allow this.

**Constraints:**

*   `1 <= nums.length, numsDivide.length <= 105`
*   `1 <= nums[i], numsDivide[i] <= 109`
Finding the Number of Visible Mountains

You are given a **0-indexed** 2D integer array `peaks` where `peaks[i] = [xi, yi]` states that mountain `i` has a peak at coordinates `(xi, yi)`. A mountain can be described as a right-angled isosceles triangle, with its base along the `x`\-axis and a right angle at its peak. More formally, the **gradients** of ascending and descending the mountain are `1` and `-1` respectively.

A mountain is considered **visible** if its peak does not lie within another mountain (including the border of other mountains).

Return _the number of visible mountains_.

**Example 1:**

**Input:** peaks = \[\[2,2\],\[6,3\],\[5,4\]\]
**Output:** 2
**Explanation:** The diagram above shows the mountains.
- Mountain 0 is visible since its peak does not lie within another mountain or its sides.
- Mountain 1 is not visible since its peak lies within the side of mountain 2.
- Mountain 2 is visible since its peak does not lie within another mountain or its sides.
There are 2 mountains that are visible.

**Example 2:**

**Input:** peaks = \[\[1,3\],\[1,3\]\]
**Output:** 0
**Explanation:** The diagram above shows the mountains (they completely overlap).
Both mountains are not visible since their peaks lie within each other.

**Constraints:**

*   `1 <= peaks.length <= 105`
*   `peaks[i].length == 2`
*   `1 <= xi, yi <= 105`
Best Poker Hand

You are given an integer array `ranks` and a character array `suits`. You have `5` cards where the `ith` card has a rank of `ranks[i]` and a suit of `suits[i]`.

The following are the types of **poker hands** you can make from best to worst:

1.  `"Flush "`: Five cards of the same suit.
2.  `"Three of a Kind "`: Three cards of the same rank.
3.  `"Pair "`: Two cards of the same rank.
4.  `"High Card "`: Any single card.

Return _a string representing the **best** type of **poker hand** you can make with the given cards._

**Note** that the return values are **case-sensitive**.

**Example 1:**

**Input:** ranks = \[13,2,3,1,9\], suits = \[ "a ", "a ", "a ", "a ", "a "\]
**Output:**  "Flush "
**Explanation:** The hand with all the cards consists of 5 cards with the same suit, so we have a  "Flush ".

**Example 2:**

**Input:** ranks = \[4,4,2,4,4\], suits = \[ "d ", "a ", "a ", "b ", "c "\]
**Output:**  "Three of a Kind "
**Explanation:** The hand with the first, second, and fourth card consists of 3 cards with the same rank, so we have a  "Three of a Kind ".
Note that we could also make a  "Pair " hand but  "Three of a Kind " is a better hand.
Also note that other cards could be used to make the  "Three of a Kind " hand.

**Example 3:**

**Input:** ranks = \[10,10,2,12,9\], suits = \[ "a ", "b ", "c ", "a ", "d "\]
**Output:**  "Pair "
**Explanation:** The hand with the first and second card consists of 2 cards with the same rank, so we have a  "Pair ".
Note that we cannot make a  "Flush " or a  "Three of a Kind ".

**Constraints:**

*   `ranks.length == suits.length == 5`
*   `1 <= ranks[i] <= 13`
*   `'a' <= suits[i] <= 'd'`
*   No two cards have the same rank and suit.
Number of Zero-Filled Subarrays

Given an integer array `nums`, return _the number of **subarrays** filled with_ `0`.

A **subarray** is a contiguous non-empty sequence of elements within an array.

**Example 1:**

**Input:** nums = \[1,3,0,0,2,0,0,4\]
**Output:** 6
**Explanation:** 
There are 4 occurrences of \[0\] as a subarray.
There are 2 occurrences of \[0,0\] as a subarray.
There is no occurrence of a subarray with a size more than 2 filled with 0. Therefore, we return 6.

**Example 2:**

**Input:** nums = \[0,0,0,2,0,0\]
**Output:** 9
**Explanation:**
There are 5 occurrences of \[0\] as a subarray.
There are 3 occurrences of \[0,0\] as a subarray.
There is 1 occurrence of \[0,0,0\] as a subarray.
There is no occurrence of a subarray with a size more than 3 filled with 0. Therefore, we return 9.

**Example 3:**

**Input:** nums = \[2,10,2019\]
**Output:** 0
**Explanation:** There is no subarray filled with 0. Therefore, we return 0.

**Constraints:**

*   `1 <= nums.length <= 105`
*   `-109 <= nums[i] <= 109`