bowang0911/leetcode huggingface dataset:
Number of Ways to Paint N × 3 Grid

You have a `grid` of size `n x 3` and you want to paint each cell of the grid with exactly one of the three colors: **Red**, **Yellow,** or **Green** while making sure that no two adjacent cells have the same color (i.e., no two cells that share vertical or horizontal sides have the same color).

Given `n` the number of rows of the grid, return _the number of ways_ you can paint this `grid`. As the answer may grow large, the answer **must be** computed modulo `109 + 7`.

**Example 1:**

**Input:** n = 1
**Output:** 12
**Explanation:** There are 12 possible way to paint the grid as shown.

**Example 2:**

**Input:** n = 5000
**Output:** 30228214

**Constraints:**

*   `n == grid.length`
*   `1 <= n <= 5000`
Minimum Value to Get Positive Step by Step Sum

Given an array of integers `nums`, you start with an initial **positive** value _startValue__._

In each iteration, you calculate the step by step sum of _startValue_ plus elements in `nums` (from left to right).

Return the minimum **positive** value of _startValue_ such that the step by step sum is never less than 1.

**Example 1:**

**Input:** nums = \[-3,2,-3,4,2\]
**Output:** 5
**Explanation:** If you choose startValue = 4, in the third iteration your step by step sum is less than 1.
**step by step sum**
**startValue = 4 | startValue = 5 | nums**
  (4 **\-3** ) = 1  | (5 **\-3** ) = 2    |  -3
  (1 **+2** ) = 3  | (2 **+2** ) = 4    |   2
  (3 **\-3** ) = 0  | (4 **\-3** ) = 1    |  -3
  (0 **+4** ) = 4  | (1 **+4** ) = 5    |   4
  (4 **+2** ) = 6  | (5 **+2** ) = 7    |   2

**Example 2:**

**Input:** nums = \[1,2\]
**Output:** 1
**Explanation:** Minimum start value should be positive. 

**Example 3:**

**Input:** nums = \[1,-2,-3\]
**Output:** 5

**Constraints:**

*   `1 <= nums.length <= 100`
*   `-100 <= nums[i] <= 100`
Find the Minimum Number of Fibonacci Numbers Whose Sum Is K

Given an integer `k`, _return the minimum number of Fibonacci numbers whose sum is equal to_ `k`. The same Fibonacci number can be used multiple times.

The Fibonacci numbers are defined as:

*   `F1 = 1`
*   `F2 = 1`
*   `Fn = Fn-1 + Fn-2` for `n > 2.`

It is guaranteed that for the given constraints we can always find such Fibonacci numbers that sum up to `k`.

**Example 1:**

**Input:** k = 7
**Output:** 2 
**Explanation:** The Fibonacci numbers are: 1, 1, 2, 3, 5, 8, 13, ... 
For k = 7 we can use 2 + 5 = 7.

**Example 2:**

**Input:** k = 10
**Output:** 2 
**Explanation:** For k = 10 we can use 2 + 8 = 10.

**Example 3:**

**Input:** k = 19
**Output:** 3 
**Explanation:** For k = 19 we can use 1 + 5 + 13 = 19.

**Constraints:**

*   `1 <= k <= 109`
The k-th Lexicographical String of All Happy Strings of Length n

A **happy string** is a string that:

*   consists only of letters of the set `['a', 'b', 'c']`.
*   `s[i] != s[i + 1]` for all values of `i` from `1` to `s.length - 1` (string is 1-indexed).

For example, strings **"abc ", "ac ", "b "** and **"abcbabcbcb "** are all happy strings and strings **"aa ", "baa "** and **"ababbc "** are not happy strings.

Given two integers `n` and `k`, consider a list of all happy strings of length `n` sorted in lexicographical order.

Return _the kth string_ of this list or return an **empty string** if there are less than `k` happy strings of length `n`.

**Example 1:**

**Input:** n = 1, k = 3
**Output:**  "c "
**Explanation:** The list \[ "a ",  "b ",  "c "\] contains all happy strings of length 1. The third string is  "c ".

**Example 2:**

**Input:** n = 1, k = 4
**Output:**  " "
**Explanation:** There are only 3 happy strings of length 1.

**Example 3:**

**Input:** n = 3, k = 9
**Output:**  "cab "
**Explanation:** There are 12 different happy string of length 3 \[ "aba ",  "abc ",  "aca ",  "acb ",  "bab ",  "bac ",  "bca ",  "bcb ",  "cab ",  "cac ",  "cba ",  "cbc "\]. You will find the 9th string =  "cab "

**Constraints:**

*   `1 <= n <= 10`
*   `1 <= k <= 100`
Restore The Array

A program was supposed to print an array of integers. The program forgot to print whitespaces and the array is printed as a string of digits `s` and all we know is that all integers in the array were in the range `[1, k]` and there are no leading zeros in the array.

Given the string `s` and the integer `k`, return _the number of the possible arrays that can be printed as_ `s` _using the mentioned program_. Since the answer may be very large, return it **modulo** `109 + 7`.

**Example 1:**

**Input:** s =  "1000 ", k = 10000
**Output:** 1
**Explanation:** The only possible array is \[1000\]

**Example 2:**

**Input:** s =  "1000 ", k = 10
**Output:** 0
**Explanation:** There cannot be an array that was printed this way and has all integer >= 1 and <= 10.

**Example 3:**

**Input:** s =  "1317 ", k = 2000
**Output:** 8
**Explanation:** Possible arrays are \[1317\],\[131,7\],\[13,17\],\[1,317\],\[13,1,7\],\[1,31,7\],\[1,3,17\],\[1,3,1,7\]

**Constraints:**

*   `1 <= s.length <= 105`
*   `s` consists of only digits and does not contain leading zeros.
*   `1 <= k <= 109`
Reformat The String

You are given an alphanumeric string `s`. (**Alphanumeric string** is a string consisting of lowercase English letters and digits).

You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. That is, no two adjacent characters have the same type.

Return _the reformatted string_ or return **an empty string** if it is impossible to reformat the string.

**Example 1:**

**Input:** s =  "a0b1c2 "
**Output:**  "0a1b2c "
**Explanation:** No two adjacent characters have the same type in  "0a1b2c ".  "a0b1c2 ",  "0a1b2c ",  "0c2a1b " are also valid permutations.

**Example 2:**

**Input:** s =  "leetcode "
**Output:**  " "
**Explanation:**  "leetcode " has only characters so we cannot separate them by digits.

**Example 3:**

**Input:** s =  "1229857369 "
**Output:**  " "
**Explanation:**  "1229857369 " has only digits so we cannot separate them by characters.

**Constraints:**

*   `1 <= s.length <= 500`
*   `s` consists of only lowercase English letters and/or digits.
Display Table of Food Orders in a Restaurant

Given the array `orders`, which represents the orders that customers have done in a restaurant. More specifically `orders[i]=[customerNamei,tableNumberi,foodItemi]` where `customerNamei` is the name of the customer, `tableNumberi` is the table customer sit at, and `foodItemi` is the item customer orders.

_Return the restaurant's "**display table**"_. The "**display table**" is a table whose row entries denote how many of each food item each table ordered. The first column is the table number and the remaining columns correspond to each food item in alphabetical order. The first row should be a header whose first column is "Table", followed by the names of the food items. Note that the customer names are not part of the table. Additionally, the rows should be sorted in numerically increasing order.

**Example 1:**

**Input:** orders = \[\[ "David ", "3 ", "Ceviche "\],\[ "Corina ", "10 ", "Beef Burrito "\],\[ "David ", "3 ", "Fried Chicken "\],\[ "Carla ", "5 ", "Water "\],\[ "Carla ", "5 ", "Ceviche "\],\[ "Rous ", "3 ", "Ceviche "\]\]
**Output:** \[\[ "Table ", "Beef Burrito ", "Ceviche ", "Fried Chicken ", "Water "\],\[ "3 ", "0 ", "2 ", "1 ", "0 "\],\[ "5 ", "0 ", "1 ", "0 ", "1 "\],\[ "10 ", "1 ", "0 ", "0 ", "0 "\]\] 
**Explanation:**
The displaying table looks like:
**Table,Beef Burrito,Ceviche,Fried Chicken,Water**
3    ,0           ,2      ,1            ,0
5    ,0           ,1      ,0            ,1
10   ,1           ,0      ,0            ,0
For the table 3: David orders  "Ceviche " and  "Fried Chicken ", and Rous orders  "Ceviche ".
For the table 5: Carla orders  "Water " and  "Ceviche ".
For the table 10: Corina orders  "Beef Burrito ". 

**Example 2:**

**Input:** orders = \[\[ "James ", "12 ", "Fried Chicken "\],\[ "Ratesh ", "12 ", "Fried Chicken "\],\[ "Amadeus ", "12 ", "Fried Chicken "\],\[ "Adam ", "1 ", "Canadian Waffles "\],\[ "Brianna ", "1 ", "Canadian Waffles "\]\]
**Output:** \[\[ "Table ", "Canadian Waffles ", "Fried Chicken "\],\[ "1 ", "2 ", "0 "\],\[ "12 ", "0 ", "3 "\]\] 
**Explanation:** 
For the table 1: Adam and Brianna order  "Canadian Waffles ".
For the table 12: James, Ratesh and Amadeus order  "Fried Chicken ".

**Example 3:**

**Input:** orders = \[\[ "Laura ", "2 ", "Bean Burrito "\],\[ "Jhon ", "2 ", "Beef Burrito "\],\[ "Melissa ", "2 ", "Soda "\]\]
**Output:** \[\[ "Table ", "Bean Burrito ", "Beef Burrito ", "Soda "\],\[ "2 ", "1 ", "1 ", "1 "\]\]

**Constraints:**

*   `1 <= orders.length <= 5 * 10^4`
*   `orders[i].length == 3`
*   `1 <= customerNamei.length, foodItemi.length <= 20`
*   `customerNamei` and `foodItemi` consist of lowercase and uppercase English letters and the space character.
*   `tableNumberi` is a valid integer between `1` and `500`.
Minimum Number of Frogs Croaking

You are given the string `croakOfFrogs`, which represents a combination of the string `"croak "` from different frogs, that is, multiple frogs can croak at the same time, so multiple `"croak "` are mixed.

_Return the minimum number of_ different _frogs to finish all the croaks in the given string._

A valid `"croak "` means a frog is printing five letters `'c'`, `'r'`, `'o'`, `'a'`, and `'k'` **sequentially**. The frogs have to print all five letters to finish a croak. If the given string is not a combination of a valid `"croak "` return `-1`.

**Example 1:**

**Input:** croakOfFrogs =  "croakcroak "
**Output:** 1 
**Explanation:** One frog yelling  "croak **"** twice.

**Example 2:**

**Input:** croakOfFrogs =  "crcoakroak "
**Output:** 2 
**Explanation:** The minimum number of frogs is two. 
The first frog could yell  "**cr**c**oak**roak ".
The second frog could yell later  "cr**c**oak**roak** ".

**Example 3:**

**Input:** croakOfFrogs =  "croakcrook "
**Output:** -1
**Explanation:** The given string is an invalid combination of  "croak **"** from different frogs.

**Constraints:**

*   `1 <= croakOfFrogs.length <= 105`
*   `croakOfFrogs` is either `'c'`, `'r'`, `'o'`, `'a'`, or `'k'`.
Build Array Where You Can Find The Maximum Exactly K Comparisons

You are given three integers `n`, `m` and `k`. Consider the following algorithm to find the maximum element of an array of positive integers:

You should build the array arr which has the following properties:

*   `arr` has exactly `n` integers.
*   `1 <= arr[i] <= m` where `(0 <= i < n)`.
*   After applying the mentioned algorithm to `arr`, the value `search_cost` is equal to `k`.

Return _the number of ways_ to build the array `arr` under the mentioned conditions. As the answer may grow large, the answer **must be** computed modulo `109 + 7`.

**Example 1:**

**Input:** n = 2, m = 3, k = 1
**Output:** 6
**Explanation:** The possible arrays are \[1, 1\], \[2, 1\], \[2, 2\], \[3, 1\], \[3, 2\] \[3, 3\]

**Example 2:**

**Input:** n = 5, m = 2, k = 3
**Output:** 0
**Explanation:** There are no possible arrays that satisify the mentioned conditions.

**Example 3:**

**Input:** n = 9, m = 1, k = 1
**Output:** 1
**Explanation:** The only possible array is \[1, 1, 1, 1, 1, 1, 1, 1, 1\]

**Constraints:**

*   `1 <= n <= 50`
*   `1 <= m <= 100`
*   `0 <= k <= n`
Maximum Score After Splitting a String

Given a string `s` of zeros and ones, _return the maximum score after splitting the string into two **non-empty** substrings_ (i.e. **left** substring and **right** substring).

The score after splitting a string is the number of **zeros** in the **left** substring plus the number of **ones** in the **right** substring.

**Example 1:**

**Input:** s =  "011101 "
**Output:** 5 
**Explanation:** 
All possible ways of splitting s into two non-empty substrings are:
left =  "0 " and right =  "11101 ", score = 1 + 4 = 5 
left =  "01 " and right =  "1101 ", score = 1 + 3 = 4 
left =  "011 " and right =  "101 ", score = 1 + 2 = 3 
left =  "0111 " and right =  "01 ", score = 1 + 1 = 2 
left =  "01110 " and right =  "1 ", score = 2 + 1 = 3

**Example 2:**

**Input:** s =  "00111 "
**Output:** 5
**Explanation:** When left =  "00 " and right =  "111 ", we get the maximum score = 2 + 3 = 5

**Example 3:**

**Input:** s =  "1111 "
**Output:** 3

**Constraints:**

*   `2 <= s.length <= 500`
*   The string `s` consists of characters `'0'` and `'1'` only.
Maximum Points You Can Obtain from Cards

There are several cards **arranged in a row**, and each card has an associated number of points. The points are given in the integer array `cardPoints`.

In one step, you can take one card from the beginning or from the end of the row. You have to take exactly `k` cards.

Your score is the sum of the points of the cards you have taken.

Given the integer array `cardPoints` and the integer `k`, return the _maximum score_ you can obtain.

**Example 1:**

**Input:** cardPoints = \[1,2,3,4,5,6,1\], k = 3
**Output:** 12
**Explanation:** After the first step, your score will always be 1. However, choosing the rightmost card first will maximize your total score. The optimal strategy is to take the three cards on the right, giving a final score of 1 + 6 + 5 = 12.

**Example 2:**

**Input:** cardPoints = \[2,2,2\], k = 2
**Output:** 4
**Explanation:** Regardless of which two cards you take, your score will always be 4.

**Example 3:**

**Input:** cardPoints = \[9,7,7,9,7,7,9\], k = 7
**Output:** 55
**Explanation:** You have to take all the cards. Your score is the sum of points of all cards.

**Constraints:**

*   `1 <= cardPoints.length <= 105`
*   `1 <= cardPoints[i] <= 104`
*   `1 <= k <= cardPoints.length`

1\. The number of unique characters in the substring must not exceed k. 2. The substring must not contain more than one instance of the same character. 3. The length of the substring must not exceed the length of the original string.
Diagonal Traverse II

Given a 2D integer array `nums`, return _all elements of_ `nums` _in diagonal order as shown in the below images_.

**Example 1:**

**Input:** nums = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\]
**Output:** \[1,4,2,7,5,3,8,6,9\]

**Example 2:**

**Input:** nums = \[\[1,2,3,4,5\],\[6,7\],\[8\],\[9,10,11\],\[12,13,14,15,16\]\]
**Output:** \[1,6,2,8,7,3,9,4,12,10,5,13,11,14,15,16\]

**Constraints:**

*   `1 <= nums.length <= 105`
*   `1 <= nums[i].length <= 105`
*   `1 <= sum(nums[i].length) <= 105`
*   `1 <= nums[i][j] <= 105`
Constrained Subsequence Sum

Given an integer array `nums` and an integer `k`, return the maximum sum of a **non-empty** subsequence of that array such that for every two **consecutive** integers in the subsequence, `nums[i]` and `nums[j]`, where `i < j`, the condition `j - i <= k` is satisfied.

A _subsequence_ of an array is obtained by deleting some number of elements (can be zero) from the array, leaving the remaining elements in their original order.

**Example 1:**

**Input:** nums = \[10,2,-10,5,20\], k = 2
**Output:** 37
**Explanation:** The subsequence is \[10, 2, 5, 20\].

**Example 2:**

**Input:** nums = \[-1,-2,-3\], k = 1
**Output:** -1
**Explanation:** The subsequence must be non-empty, so we choose the largest number.

**Example 3:**

**Input:** nums = \[10,-2,-10,-5,20\], k = 2
**Output:** 23
**Explanation:** The subsequence is \[10, -2, -5, 20\].

**Constraints:**

*   `1 <= k <= nums.length <= 105`
*   `-104 <= nums[i] <= 104`
Counting Elements

Given an integer array `arr`, count how many elements `x` there are, such that `x + 1` is also in `arr`. If there are duplicates in `arr`, count them separately.

**Example 1:**

**Input:** arr = \[1,2,3\]
**Output:** 2
**Explanation:** 1 and 2 are counted cause 2 and 3 are in arr.

**Example 2:**

**Input:** arr = \[1,1,3,3,5,5,7,7\]
**Output:** 0
**Explanation:** No numbers are counted, cause there is no 2, 4, 6, or 8 in arr.

**Constraints:**

*   `1 <= arr.length <= 1000`
*   `0 <= arr[i] <= 1000`
Perform String Shifts

You are given a string `s` containing lowercase English letters, and a matrix `shift`, where `shift[i] = [directioni, amounti]`:

*   `directioni` can be `0` (for left shift) or `1` (for right shift).
*   `amounti` is the amount by which string `s` is to be shifted.
*   A left shift by 1 means remove the first character of `s` and append it to the end.
*   Similarly, a right shift by 1 means remove the last character of `s` and add it to the beginning.

Return the final string after all operations.

**Example 1:**

**Input:** s =  "abc ", shift = \[\[0,1\],\[1,2\]\]
**Output:**  "cab "
**Explanation:** 
\[0,1\] means shift to left by 1.  "abc " ->  "bca "
\[1,2\] means shift to right by 2.  "bca " ->  "cab "

**Example 2:**

**Input:** s =  "abcdefg ", shift = \[\[1,1\],\[1,1\],\[0,2\],\[1,3\]\]
**Output:**  "efgabcd "
**Explanation:**  
\[1,1\] means shift to right by 1.  "abcdefg " ->  "gabcdef "
\[1,1\] means shift to right by 1.  "gabcdef " ->  "fgabcde "
\[0,2\] means shift to left by 2.  "fgabcde " ->  "abcdefg "
\[1,3\] means shift to right by 3.  "abcdefg " ->  "efgabcd "

**Constraints:**

*   `1 <= s.length <= 100`
*   `s` only contains lower case English letters.
*   `1 <= shift.length <= 100`
*   `shift[i].length == 2`
*   `directioni` is either `0` or `1`.
*   `0 <= amounti <= 100`
Leftmost Column with at Least a One

A **row-sorted binary matrix** means that all elements are `0` or `1` and each row of the matrix is sorted in non-decreasing order.

Given a **row-sorted binary matrix** `binaryMatrix`, return _the index (0-indexed) of the **leftmost column** with a 1 in it_. If such an index does not exist, return `-1`.

**You can't access the Binary Matrix directly.** You may only access the matrix using a `BinaryMatrix` interface:

*   `BinaryMatrix.get(row, col)` returns the element of the matrix at index `(row, col)` (0-indexed).
*   `BinaryMatrix.dimensions()` returns the dimensions of the matrix as a list of 2 elements `[rows, cols]`, which means the matrix is `rows x cols`.

Submissions making more than `1000` calls to `BinaryMatrix.get` will be judged _Wrong Answer_. Also, any solutions that attempt to circumvent the judge will result in disqualification.

For custom testing purposes, the input will be the entire binary matrix `mat`. You will not have access to the binary matrix directly.

**Example 1:**

**Input:** mat = \[\[0,0\],\[1,1\]\]
**Output:** 0

**Example 2:**

**Input:** mat = \[\[0,0\],\[0,1\]\]
**Output:** 1

**Example 3:**

**Input:** mat = \[\[0,0\],\[0,0\]\]
**Output:** -1

**Constraints:**

*   `rows == mat.length`
*   `cols == mat[i].length`
*   `1 <= rows, cols <= 100`
*   `mat[i][j]` is either `0` or `1`.
*   `mat[i]` is sorted in non-decreasing order.
First Unique Number

You have a queue of integers, you need to retrieve the first unique integer in the queue.

Implement the `FirstUnique` class:

*   `FirstUnique(int[] nums)` Initializes the object with the numbers in the queue.
*   `int showFirstUnique()` returns the value of **the first unique** integer of the queue, and returns **\-1** if there is no such integer.
*   `void add(int value)` insert value to the queue.

**Example 1:**

**Input:** 
\[ "FirstUnique ", "showFirstUnique ", "add ", "showFirstUnique ", "add ", "showFirstUnique ", "add ", "showFirstUnique "\]
\[\[\[2,3,5\]\],\[\],\[5\],\[\],\[2\],\[\],\[3\],\[\]\]
**Output:** 
\[null,2,null,2,null,3,null,-1\]
**Explanation:** 
FirstUnique firstUnique = new FirstUnique(\[2,3,5\]);
firstUnique.showFirstUnique(); // return 2
firstUnique.add(5);            // the queue is now \[2,3,5,5\]
firstUnique.showFirstUnique(); // return 2
firstUnique.add(2);            // the queue is now \[2,3,5,5,2\]
firstUnique.showFirstUnique(); // return 3
firstUnique.add(3);            // the queue is now \[2,3,5,5,2,3\]
firstUnique.showFirstUnique(); // return -1

**Example 2:**

**Input:** 
\[ "FirstUnique ", "showFirstUnique ", "add ", "add ", "add ", "add ", "add ", "showFirstUnique "\]
\[\[\[7,7,7,7,7,7\]\],\[\],\[7\],\[3\],\[3\],\[7\],\[17\],\[\]\]
**Output:** 
\[null,-1,null,null,null,null,null,17\]
**Explanation:** 
FirstUnique firstUnique = new FirstUnique(\[7,7,7,7,7,7\]);
firstUnique.showFirstUnique(); // return -1
firstUnique.add(7);            // the queue is now \[7,7,7,7,7,7,7\]
firstUnique.add(3);            // the queue is now \[7,7,7,7,7,7,7,3\]
firstUnique.add(3);            // the queue is now \[7,7,7,7,7,7,7,3,3\]
firstUnique.add(7);            // the queue is now \[7,7,7,7,7,7,7,3,3,7\]
firstUnique.add(17);           // the queue is now \[7,7,7,7,7,7,7,3,3,7,17\]
firstUnique.showFirstUnique(); // return 17

**Example 3:**

**Input:** 
\[ "FirstUnique ", "showFirstUnique ", "add ", "showFirstUnique "\]
\[\[\[809\]\],\[\],\[809\],\[\]\]
**Output:** 
\[null,809,null,-1\]
**Explanation:** 
FirstUnique firstUnique = new FirstUnique(\[809\]);
firstUnique.showFirstUnique(); // return 809
firstUnique.add(809);          // the queue is now \[809,809\]
firstUnique.showFirstUnique(); // return -1

**Constraints:**

*   `1 <= nums.length <= 10^5`
*   `1 <= nums[i] <= 10^8`
*   `1 <= value <= 10^8`
*   At most `50000` calls will be made to `showFirstUnique` and `add`.
Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree

Given a binary tree where each path going from the root to any leaf form a **valid sequence**, check if a given string is a **valid sequence** in such binary tree.

We get the given string from the concatenation of an array of integers `arr` and the concatenation of all values of the nodes along a path results in a **sequence** in the given binary tree.

**Example 1:**

**Input:** root = \[0,1,0,0,1,0,null,null,1,0,0\], arr = \[0,1,0,1\]
**Output:** true
**Explanation:** 
The path 0 -> 1 -> 0 -> 1 is a valid sequence (green color in the figure). 
Other valid sequences are: 
0 -> 1 -> 1 -> 0 
0 -> 0 -> 0

**Example 2:**

**Input:** root = \[0,1,0,0,1,0,null,null,1,0,0\], arr = \[0,0,1\]
**Output:** false 
**Explanation:** The path 0 -> 0 -> 1 does not exist, therefore it is not even a sequence.

**Example 3:**

**Input:** root = \[0,1,0,0,1,0,null,null,1,0,0\], arr = \[0,1,1\]
**Output:** false
**Explanation:** The path 0 -> 1 -> 1 is a sequence, but it is not a valid sequence.

**Constraints:**

*   `1 <= arr.length <= 5000`
*   `0 <= arr[i] <= 9`
*   Each node's value is between \[0 - 9\].
Kids With the Greatest Number of Candies

There are `n` kids with candies. You are given an integer array `candies`, where each `candies[i]` represents the number of candies the `ith` kid has, and an integer `extraCandies`, denoting the number of extra candies that you have.

Return _a boolean array_ `result` _of length_ `n`_, where_ `result[i]` _is_ `true` _if, after giving the_ `ith` _kid all the_ `extraCandies`_, they will have the **greatest** number of candies among all the kids__, or_ `false` _otherwise_.

Note that **multiple** kids can have the **greatest** number of candies.

**Example 1:**

**Input:** candies = \[2,3,5,1,3\], extraCandies = 3
**Output:** \[true,true,true,false,true\] 
**Explanation:** If you give all extraCandies to:
- Kid 1, they will have 2 + 3 = 5 candies, which is the greatest among the kids.
- Kid 2, they will have 3 + 3 = 6 candies, which is the greatest among the kids.
- Kid 3, they will have 5 + 3 = 8 candies, which is the greatest among the kids.
- Kid 4, they will have 1 + 3 = 4 candies, which is not the greatest among the kids.
- Kid 5, they will have 3 + 3 = 6 candies, which is the greatest among the kids.

**Example 2:**

**Input:** candies = \[4,2,1,1,2\], extraCandies = 1
**Output:** \[true,false,false,false,false\] 
**Explanation:** There is only 1 extra candy.
Kid 1 will always have the greatest number of candies, even if a different kid is given the extra candy.

**Example 3:**

**Input:** candies = \[12,1,12\], extraCandies = 10
**Output:** \[true,false,true\]

**Constraints:**

*   `n == candies.length`
*   `2 <= n <= 100`
*   `1 <= candies[i] <= 100`
*   `1 <= extraCandies <= 50`