count-the-number-of-powerful-integers

Count the Number of Powerful Integers

Prompt:
"""
You are given three integers start, finish, and limit. You are also given a 0-indexed string s representing a positive integer.
A positive integer x is called powerful if it ends with s (in other words, s is a suffix of x) and each digit in x is at most limit.
Return the total number of powerful integers in the range [start..finish].
A string x is a suffix of a string y if and only if x is a substring of y that starts from some index (including 0) in y and extends to the index y.length - 1. For example, 25 is a suffix of 5125 whereas 512 is not.

Example 1:

Input: start = 1, finish = 6000, limit = 4, s = "124"
Output: 5
Explanation: The powerful integers in the range [1..6000] are 124, 1124, 2124, 3124, and, 4124. All these integers have each digit <= 4, and "124" as a suffix. Note that 5124 is not a powerful integer because the first digit is 5 which is greater than 4.
It can be shown that there are only 5 powerful integers in this range.

Example 2:

Input: start = 15, finish = 215, limit = 6, s = "10"
Output: 2
Explanation: The powerful integers in the range [15..215] are 110 and 210. All these integers have each digit <= 6, and "10" as a suffix.
It can be shown that there are only 2 powerful integers in this range.

Example 3:

Input: start = 1000, finish = 2000, limit = 4, s = "3000"
Output: 0
Explanation: All integers in the range [1000..2000] are smaller than 3000, hence "3000" cannot be a suffix of any integer in this range.

Constraints:

1 <= start <= finish <= 1015
1 <= limit <= 9
1 <= s.length <= floor(log10(finish)) + 1
s only consists of numeric digits which are at most limit.
s does not have leading zeros.
"""
class Solution:
    def numberOfPowerfulInt(self, start: int, finish: int, limit: int, s: str) -> int:

You are given three integers start, finish, and limit. You are also given a 0-indexed string s representing a positive integer.
A positive integer x is called powerful if it ends with s (in other words, s is a suffix of x) and each digit in x is at most limit.
Return the total number of powerful integers in the range [start..finish].
A string x is a suffix of a string y if and only if x is a substring of y that starts from some index (including 0) in y and extends to the index y.length - 1. For example, 25 is a suffix of 5125 whereas 512 is not.

Example 1:

Input: start = 1, finish = 6000, limit = 4, s = "124"
Output: 5
Explanation: The powerful integers in the range [1..6000] are 124, 1124, 2124, 3124, and, 4124. All these integers have each digit <= 4, and "124" as a suffix. Note that 5124 is not a powerful integer because the first digit is 5 which is greater than 4.
It can be shown that there are only 5 powerful integers in this range.

Example 2:

Input: start = 15, finish = 215, limit = 6, s = "10"
Output: 2
Explanation: The powerful integers in the range [15..215] are 110 and 210. All these integers have each digit <= 6, and "10" as a suffix.
It can be shown that there are only 2 powerful integers in this range.

Example 3:

Input: start = 1000, finish = 2000, limit = 4, s = "3000"
Output: 0
Explanation: All integers in the range [1000..2000] are smaller than 3000, hence "3000" cannot be a suffix of any integer in this range.

Constraints:

1 <= start <= finish <= 1015
1 <= limit <= 9
1 <= s.length <= floor(log10(finish)) + 1
s only consists of numeric digits which are at most limit.
s does not have leading zeros.

Please complete the code below to solve above prblem:
```python
class Solution:
    def numberOfPowerfulInt(self, start: int, finish: int, limit: int, s: str) -> int:

```

my_solution = Solution()

test_input = { "start": 1, "finish": 6000, "limit": 4, "s": "124" }
assert my_solution.numberOfPowerfulInt(**test_input) == 5

test_input = { "start": 15, "finish": 215, "limit": 6, "s": "10" }
assert my_solution.numberOfPowerfulInt(**test_input) == 2

test_input = { "start": 1000, "finish": 2000, "limit": 4, "s": "3000" }
assert my_solution.numberOfPowerfulInt(**test_input) == 0

test_input = { "start": 141, "finish": 148, "limit": 9, "s": "9" }
assert my_solution.numberOfPowerfulInt(**test_input) == 0

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "17" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "27" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "41" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "47" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "61" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "66" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "71" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "72" }
assert my_solution.numberOfPowerfulInt(**test_input) == 9

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "24" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "32" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "41" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "44" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 1300, "finish": 1400, "limit": 5, "s": "245" }
assert my_solution.numberOfPowerfulInt(**test_input) == 0

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "13" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "21" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "34" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "21" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "23" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "31" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "34" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "24" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "30" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "44" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "13" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "22" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "30" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "1" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "10" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "100" }
assert my_solution.numberOfPowerfulInt(**test_input) == 2

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "13" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "15" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "16" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "17" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "18" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "2" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "21" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "22" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "23" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "24" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "25" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "26" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "27" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "28" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "3" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "30" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "31" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "32" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "34" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "35" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "36" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "37" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "38" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "4" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "41" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "44" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "45" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "46" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "47" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "48" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "5" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "50" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "51" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "52" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "53" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18


check-if-bitwise-or-has-trailing-zeros

Check if Bitwise OR Has Trailing Zeros

Prompt:
"""
You are given an array of positive integers nums.
You have to check if it is possible to select two or more elements in the array such that the bitwise OR of the selected elements has at least one trailing zero in its binary representation.
For example, the binary representation of 5, which is "101", does not have any trailing zeros, whereas the binary representation of 4, which is "100", has two trailing zeros.
Return true if it is possible to select two or more elements whose bitwise OR has trailing zeros, return false otherwise.

Example 1:

Input: nums = [1,2,3,4,5]
Output: true
Explanation: If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation "110" with one trailing zero.

Example 2:

Input: nums = [2,4,8,16]
Output: true
Explanation: If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation "110" with one trailing zero.
Other possible ways to select elements to have trailing zeroes in the binary representation of their bitwise OR are: (2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), and (2, 4, 8, 16).

Example 3:

Input: nums = [1,3,5,7,9]
Output: false
Explanation: There is no possible way to select two or more elements to have trailing zeros in the binary representation of their bitwise OR.

Constraints:

2 <= nums.length <= 100
1 <= nums[i] <= 100
"""
class Solution:
    def hasTrailingZeros(self, nums: List[int]) -> bool:

You are given an array of positive integers nums.
You have to check if it is possible to select two or more elements in the array such that the bitwise OR of the selected elements has at least one trailing zero in its binary representation.
For example, the binary representation of 5, which is "101", does not have any trailing zeros, whereas the binary representation of 4, which is "100", has two trailing zeros.
Return true if it is possible to select two or more elements whose bitwise OR has trailing zeros, return false otherwise.

Example 1:

Input: nums = [1,2,3,4,5]
Output: true
Explanation: If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation "110" with one trailing zero.

Example 2:

Input: nums = [2,4,8,16]
Output: true
Explanation: If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation "110" with one trailing zero.
Other possible ways to select elements to have trailing zeroes in the binary representation of their bitwise OR are: (2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), and (2, 4, 8, 16).

Example 3:

Input: nums = [1,3,5,7,9]
Output: false
Explanation: There is no possible way to select two or more elements to have trailing zeros in the binary representation of their bitwise OR.

Constraints:

2 <= nums.length <= 100
1 <= nums[i] <= 100

Please complete the code below to solve above prblem:
```python
class Solution:
    def hasTrailingZeros(self, nums: List[int]) -> bool:

```

my_solution = Solution()

test_input = { "nums": [1,2,3,4,5] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [1,3,5,7,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [1,2] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [2,4,8,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [1,3] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [1,7] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [3,3] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [3,4] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [2,2] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [4,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [4,32] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [6,2] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [6,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [3,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [4,3] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [5,6] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [7,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [8,2] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [8,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [7,10] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [9,73] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [8,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [10,5] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [11,17] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [19,11] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [19,35] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [19,51] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [21,61] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [23,21] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [25,25] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [10,2] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [12,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [27,77] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,32] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [29,13] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [37,69] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [39,53] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [24,32] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [32,32] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [42,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [45,24] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [64,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [49,23] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [4,6,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [8,16,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [57,27] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [8,16,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [10,4,6] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [12,8,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [63,47] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [67,69] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [69,87] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,8,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [77,49] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [89,31] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [1,3,4] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [1,5,3] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [1,7,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [3,69,59] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,16,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [6,5,5] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [7,77,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [9,77,51] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,32,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,32,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [10,1,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [10,7,5] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [11,23,27] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [15,13,63] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [21,27,79] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [23,23,47] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [35,91,15] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [32,4,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [32,8,48] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [33,40,84] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [41,83,53] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [64,48,6] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [75,34,58] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [3,8,2,3] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [43,15,41] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [43,65,79] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [47,7,19] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [4,6,1,1] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [4,10,1,7] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [49,73,81] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [6,3,10,6] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [6,4,2,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [6,12,12,24] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [7,2,4,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [8,6,4,32] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [8,12,16,2] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [12,64,16,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,4,8,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [51,33,25] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,8,64,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,16,12,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [51,43,9] }
assert my_solution.hasTrailingZeros(**test_input) == False


find-longest-special-substring-that-occurs-thrice-i

Find Longest Special Substring That Occurs Thrice I

Prompt:
"""
You are given a string s that consists of lowercase English letters.
A string is called special if it is made up of only a single character. For example, the string "abc" is not special, whereas the strings "ddd", "zz", and "f" are special.
Return the length of the longest special substring of s which occurs at least thrice, or -1 if no special substring occurs at least thrice.
A substring is a contiguous non-empty sequence of characters within a string.

Example 1:

Input: s = "aaaa"
Output: 2
Explanation: The longest special substring which occurs thrice is "aa": substrings "aaaa", "aaaa", and "aaaa".
It can be shown that the maximum length achievable is 2.

Example 2:

Input: s = "abcdef"
Output: -1
Explanation: There exists no special substring which occurs at least thrice. Hence return -1.

Example 3:

Input: s = "abcaba"
Output: 1
Explanation: The longest special substring which occurs thrice is "a": substrings "abcaba", "abcaba", and "abcaba".
It can be shown that the maximum length achievable is 1.

Constraints:

3 <= s.length <= 50
s consists of only lowercase English letters.
"""
class Solution:
    def maximumLength(self, s: str) -> int:

You are given a string s that consists of lowercase English letters.
A string is called special if it is made up of only a single character. For example, the string "abc" is not special, whereas the strings "ddd", "zz", and "f" are special.
Return the length of the longest special substring of s which occurs at least thrice, or -1 if no special substring occurs at least thrice.
A substring is a contiguous non-empty sequence of characters within a string.

Example 1:

Input: s = "aaaa"
Output: 2
Explanation: The longest special substring which occurs thrice is "aa": substrings "aaaa", "aaaa", and "aaaa".
It can be shown that the maximum length achievable is 2.

Example 2:

Input: s = "abcdef"
Output: -1
Explanation: There exists no special substring which occurs at least thrice. Hence return -1.

Example 3:

Input: s = "abcaba"
Output: 1
Explanation: The longest special substring which occurs thrice is "a": substrings "abcaba", "abcaba", and "abcaba".
It can be shown that the maximum length achievable is 1.

Constraints:

3 <= s.length <= 50
s consists of only lowercase English letters.

Please complete the code below to solve above prblem:
```python
class Solution:
    def maximumLength(self, s: str) -> int:

```

my_solution = Solution()

test_input = { "s": "aaaa" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "abcdef" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "abcaba" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "abcccccdddd" }
assert my_solution.maximumLength(**test_input) == 3

test_input = { "s": "aaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "acc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cab" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cad" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cbc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dca" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "fff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ggg" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kkk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "lll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ppp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxx" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "yyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "aaau" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "affe" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "agae" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "aiii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbbb" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbbz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "beee" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bnnn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bsss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bxxx" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cafc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ccag" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cfff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dddd" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "dsss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eeew" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gfdc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "giii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hhhn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hyyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "iiii" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "jiii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "jjjj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "kbbb" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "looo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnnn" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "oaaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "osss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "pppp" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "pppw" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqqc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqqo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqqq" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "reee" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rzzz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "thhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "tttt" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "unnn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "uuuu" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "uyyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vfff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vvvv" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "wbbb" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "wqqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "wwwg" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxxk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxxx" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "zfff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ammmm" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "aqqqu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "axxxx" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bahhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbbbz" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "biaei" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "bjjjj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "cccll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ceaaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cjlll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "crqqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cyyyy" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "ddddj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "ddddt" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "dkkkk" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "eefff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "efage" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "epppp" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "fafff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ffbbb" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ffffr" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "gcgbf" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "gcooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gfgec" }
assert my_solution.maximumLength(**test_input) == -1


find-longest-special-substring-that-occurs-thrice-ii

Find Longest Special Substring That Occurs Thrice II

Prompt:
"""
You are given a string s that consists of lowercase English letters.
A string is called special if it is made up of only a single character. For example, the string "abc" is not special, whereas the strings "ddd", "zz", and "f" are special.
Return the length of the longest special substring of s which occurs at least thrice, or -1 if no special substring occurs at least thrice.
A substring is a contiguous non-empty sequence of characters within a string.

Example 1:

Input: s = "aaaa"
Output: 2
Explanation: The longest special substring which occurs thrice is "aa": substrings "aaaa", "aaaa", and "aaaa".
It can be shown that the maximum length achievable is 2.

Example 2:

Input: s = "abcdef"
Output: -1
Explanation: There exists no special substring which occurs at least thrice. Hence return -1.

Example 3:

Input: s = "abcaba"
Output: 1
Explanation: The longest special substring which occurs thrice is "a": substrings "abcaba", "abcaba", and "abcaba".
It can be shown that the maximum length achievable is 1.

Constraints:

3 <= s.length <= 5 * 105
s consists of only lowercase English letters.
"""
class Solution:
    def maximumLength(self, s: str) -> int:

You are given a string s that consists of lowercase English letters.
A string is called special if it is made up of only a single character. For example, the string "abc" is not special, whereas the strings "ddd", "zz", and "f" are special.
Return the length of the longest special substring of s which occurs at least thrice, or -1 if no special substring occurs at least thrice.
A substring is a contiguous non-empty sequence of characters within a string.

Example 1:

Input: s = "aaaa"
Output: 2
Explanation: The longest special substring which occurs thrice is "aa": substrings "aaaa", "aaaa", and "aaaa".
It can be shown that the maximum length achievable is 2.

Example 2:

Input: s = "abcdef"
Output: -1
Explanation: There exists no special substring which occurs at least thrice. Hence return -1.

Example 3:

Input: s = "abcaba"
Output: 1
Explanation: The longest special substring which occurs thrice is "a": substrings "abcaba", "abcaba", and "abcaba".
It can be shown that the maximum length achievable is 1.

Constraints:

3 <= s.length <= 5 * 105
s consists of only lowercase English letters.

Please complete the code below to solve above prblem:
```python
class Solution:
    def maximumLength(self, s: str) -> int:

```

my_solution = Solution()

test_input = { "s": "aaaa" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "abcdef" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "abcaba" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "abcccccdddd" }
assert my_solution.maximumLength(**test_input) == 3

test_input = { "s": "acd" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "bad" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "bbc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cda" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "dab" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eee" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "fff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "jjj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kkk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "lll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "mmm" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ppp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "sss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vvv" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "yyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "aaaj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "aada" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "accc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "auuu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "azzz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbbb" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbbr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "brrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cccc" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "clll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dbac" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "dddd" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "dddr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dddu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dzzz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eeee" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "efda" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "efdc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ekkk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ggge" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gggp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gggr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gggy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "guuu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hwww" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hxxx" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "jjjj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "jjjk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kkkk" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "lllm" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "lttt" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "mwww" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnnd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnni" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "oooe" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "oooh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "oooo" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "oooq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "paaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "pggg" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rrrr" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "smmm" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "thhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "tttt" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "uuuu" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "vppp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xqqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxxj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ysss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "zzzz" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "aaaak" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbbjj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbvvv" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bfooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "buooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cffff" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "cirrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cwwwv" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ddhhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "deeee" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "deiii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dtttk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eeeeq" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "eeekk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eesss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "euuuu" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "euylz" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "fffhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "fpddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gcccn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gtwww" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hcfff" }
assert my_solution.maximumLength(**test_input) == 1


palindrome-rearrangement-queries

Palindrome Rearrangement Queries

Prompt:
"""
You are given a 0-indexed string s having an even length n.
You are also given a 0-indexed 2D integer array, queries, where queries[i] = [ai, bi, ci, di].
For each query i, you are allowed to perform the following operations:

Rearrange the characters within the substring s[ai:bi], where 0 <= ai <= bi < n / 2.
Rearrange the characters within the substring s[ci:di], where n / 2 <= ci <= di < n.

For each query, your task is to determine whether it is possible to make s a palindrome by performing the operations.
Each query is answered independently of the others.
Return a 0-indexed array answer, where answer[i] == true if it is possible to make s a palindrome by performing operations specified by the ith query, and false otherwise.

A substring is a contiguous sequence of characters within a string.
s[x:y] represents the substring consisting of characters from the index x to index y in s, both inclusive.

Example 1:

Input: s = "abcabc", queries = [[1,1,3,5],[0,2,5,5]]
Output: [true,true]
Explanation: In this example, there are two queries:
In the first query:
- a0 = 1, b0 = 1, c0 = 3, d0 = 5.
- So, you are allowed to rearrange s[1:1] => abcabc and s[3:5] => abcabc.
- To make s a palindrome, s[3:5] can be rearranged to become => abccba.
- Now, s is a palindrome. So, answer[0] = true.
In the second query:
- a1 = 0, b1 = 2, c1 = 5, d1 = 5.
- So, you are allowed to rearrange s[0:2] => abcabc and s[5:5] => abcabc.
- To make s a palindrome, s[0:2] can be rearranged to become => cbaabc.
- Now, s is a palindrome. So, answer[1] = true.

Example 2:

Input: s = "abbcdecbba", queries = [[0,2,7,9]]
Output: [false]
Explanation: In this example, there is only one query.
a0 = 0, b0 = 2, c0 = 7, d0 = 9.
So, you are allowed to rearrange s[0:2] => abbcdecbba and s[7:9] => abbcdecbba.
It is not possible to make s a palindrome by rearranging these substrings because s[3:6] is not a palindrome.
So, answer[0] = false.
Example 3:

Input: s = "acbcab", queries = [[1,2,4,5]]
Output: [true]
Explanation: In this example, there is only one query.
a0 = 1, b0 = 2, c0 = 4, d0 = 5.
So, you are allowed to rearrange s[1:2] => acbcab and s[4:5] => acbcab.
To make s a palindrome s[1:2] can be rearranged to become abccab.
Then, s[4:5] can be rearranged to become abccba.
Now, s is a palindrome. So, answer[0] = true.

Constraints:

2 <= n == s.length <= 105
1 <= queries.length <= 105
queries[i].length == 4
ai == queries[i][0], bi == queries[i][1]
ci == queries[i][2], di == queries[i][3]
0 <= ai <= bi < n / 2
n / 2 <= ci <= di < n
n is even.
s consists of only lowercase English letters.
"""
class Solution:
    def canMakePalindromeQueries(self, s: str, queries: List[List[int]]) -> List[bool]:

You are given a 0-indexed string s having an even length n.
You are also given a 0-indexed 2D integer array, queries, where queries[i] = [ai, bi, ci, di].
For each query i, you are allowed to perform the following operations:

Rearrange the characters within the substring s[ai:bi], where 0 <= ai <= bi < n / 2.
Rearrange the characters within the substring s[ci:di], where n / 2 <= ci <= di < n.

For each query, your task is to determine whether it is possible to make s a palindrome by performing the operations.
Each query is answered independently of the others.
Return a 0-indexed array answer, where answer[i] == true if it is possible to make s a palindrome by performing operations specified by the ith query, and false otherwise.

A substring is a contiguous sequence of characters within a string.
s[x:y] represents the substring consisting of characters from the index x to index y in s, both inclusive.

Example 1:

Input: s = "abcabc", queries = [[1,1,3,5],[0,2,5,5]]
Output: [true,true]
Explanation: In this example, there are two queries:
In the first query:
- a0 = 1, b0 = 1, c0 = 3, d0 = 5.
- So, you are allowed to rearrange s[1:1] => abcabc and s[3:5] => abcabc.
- To make s a palindrome, s[3:5] can be rearranged to become => abccba.
- Now, s is a palindrome. So, answer[0] = true.
In the second query:
- a1 = 0, b1 = 2, c1 = 5, d1 = 5.
- So, you are allowed to rearrange s[0:2] => abcabc and s[5:5] => abcabc.
- To make s a palindrome, s[0:2] can be rearranged to become => cbaabc.
- Now, s is a palindrome. So, answer[1] = true.

Example 2:

Input: s = "abbcdecbba", queries = [[0,2,7,9]]
Output: [false]
Explanation: In this example, there is only one query.
a0 = 0, b0 = 2, c0 = 7, d0 = 9.
So, you are allowed to rearrange s[0:2] => abbcdecbba and s[7:9] => abbcdecbba.
It is not possible to make s a palindrome by rearranging these substrings because s[3:6] is not a palindrome.
So, answer[0] = false.
Example 3:

Input: s = "acbcab", queries = [[1,2,4,5]]
Output: [true]
Explanation: In this example, there is only one query.
a0 = 1, b0 = 2, c0 = 4, d0 = 5.
So, you are allowed to rearrange s[1:2] => acbcab and s[4:5] => acbcab.
To make s a palindrome s[1:2] can be rearranged to become abccab.
Then, s[4:5] can be rearranged to become abccba.
Now, s is a palindrome. So, answer[0] = true.

Constraints:

2 <= n == s.length <= 105
1 <= queries.length <= 105
queries[i].length == 4
ai == queries[i][0], bi == queries[i][1]
ci == queries[i][2], di == queries[i][3]
0 <= ai <= bi < n / 2
n / 2 <= ci <= di < n
n is even.
s consists of only lowercase English letters.

Please complete the code below to solve above prblem:
```python
class Solution:
    def canMakePalindromeQueries(self, s: str, queries: List[List[int]]) -> List[bool]:

```

my_solution = Solution()

test_input = { "s": "abcabc", "queries": [[1,1,3,5],[0,2,5,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "abbcdecbba", "queries": [[0,2,7,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "acbcab", "queries": [[1,2,4,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "bcdbdc", "queries": [[1,2,3,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "bb", "queries": [[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "eoquueqo", "queries": [[3,3,6,6]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "dd", "queries": [[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "ceddceddcc", "queries": [[0,1,6,8]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "bdbd", "queries": [[0,0,2,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "eeee", "queries": [[0,1,2,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "deebdeeddb", "queries": [[1,2,5,7]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "xwaswsxwaw", "queries": [[1,3,5,6]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "askloakosala", "queries": [[2,4,7,10]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "bbccbb", "queries": [[0,1,4,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "djaypzjpyzad", "queries": [[0,3,7,8]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "ajvnbnznjnzbva", "queries": [[5,6,10,11]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "vbeptwzvtwpzbe", "queries": [[3,6,10,11]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "cababc", "queries": [[1,2,3,4]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "cbbbbc", "queries": [[1,1,5,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "qupzexxhqxpzhxeu", "queries": [[2,4,8,12]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "cdbdbc", "queries": [[1,2,3,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "odaxusaweuasuoeudxwa", "queries": [[0,5,10,14]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "ujfscqolkwjucoswlkfq", "queries": [[1,9,17,18]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "ceacea", "queries": [[0,2,3,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "bnjzcgmnecxxbmnjngxzecxc", "queries": [[8,9,19,22]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "daeaed", "queries": [[0,2,3,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "ddaadd", "queries": [[0,2,3,4]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "ddedde", "queries": [[0,2,4,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "pmzwetzhzursuhmeswpzrztz", "queries": [[4,6,16,17]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "qcryjkdzmqyoojzrckymdqyq", "queries": [[2,8,21,22]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "qdltkndnclarncadtqnlldkr", "queries": [[3,4,15,16]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "ecbbce", "queries": [[0,1,3,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "eczecz", "queries": [[0,0,3,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "etuouqokbalafokfbuqaaoetlu", "queries": [[3,11,21,23]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "mpepem", "queries": [[0,2,3,4]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "nbpechkpmudbsenphdmsbbupck", "queries": [[6,7,18,19]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "bccacacb", "queries": [[3,3,4,7]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "stgjtzqwgkuadjgqugkwdtzast", "queries": [[5,10,13,23]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "qiyikbayvhkcgxyaqckgxkhivbyi", "queries": [[5,12,17,24]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "ceedceed", "queries": [[0,1,4,7]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "rcguwczbjhjhgqrggqcbwjzhjuch", "queries": [[5,7,16,20]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "ckwbnmqmtzbixrrkixbtbqzmnwmc", "queries": [[1,9,15,24]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True]

test_input = { "s": "riirxzxuqpspoiixpirsoxrzpiuq", "queries": [[1,6,14,21]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "geettndnusqufidtqdfgtsieenundu", "queries": [[6,8,19,23]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False]

test_input = { "s": "bb", "queries": [[0,0,1,1],[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "cc", "queries": [[0,0,1,1],[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "dd", "queries": [[0,0,1,1],[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "ee", "queries": [[0,0,1,1],[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "aeae", "queries": [[1,1,2,3],[1,1,3,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,False]

test_input = { "s": "eaae", "queries": [[0,1,3,3],[0,0,2,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "eded", "queries": [[0,1,2,3],[1,1,2,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "lrlr", "queries": [[0,1,2,3],[0,0,2,2]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,False]

test_input = { "s": "dbaabd", "queries": [[0,1,5,5],[1,2,4,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "dcbcbd", "queries": [[0,1,4,4],[0,2,3,4]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,True]

test_input = { "s": "hykkyh", "queries": [[0,0,3,4],[1,2,3,4]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "lvrvrl", "queries": [[2,2,4,5],[0,2,3,4]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,True]

test_input = { "s": "adceaecd", "queries": [[3,3,5,5],[0,1,4,6]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,True]

test_input = { "s": "baadadba", "queries": [[1,2,4,5],[0,2,4,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,True]

test_input = { "s": "bceaabec", "queries": [[1,3,4,7],[0,2,6,6]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "ifchcifh", "queries": [[1,2,5,6],[1,1,4,6]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "adeeeeeaed", "queries": [[2,4,7,9],[3,4,8,8]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,False]

test_input = { "s": "aedbdbddea", "queries": [[4,4,7,8],[2,2,8,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "caeaaaaaec", "queries": [[0,2,5,8],[0,0,5,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True]

test_input = { "s": "dbaccccdba", "queries": [[4,4,6,7],[2,3,8,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "deabadabea", "queries": [[0,3,7,9],[0,2,5,7]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,True]

test_input = { "s": "eddeededee", "queries": [[0,3,6,9],[0,0,6,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "eedbbedebb", "queries": [[2,2,6,7],[2,2,5,6]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "gvtkakgvat", "queries": [[1,2,7,7],[2,3,7,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "bzvvicviczbv", "queries": [[1,2,7,8],[1,4,7,8]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "ljccjajcljac", "queries": [[2,4,6,10],[3,5,7,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "rxvzvezvrvxe", "queries": [[1,4,8,10],[3,3,10,11]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "amgpelwpmlaewg", "queries": [[3,4,7,9],[0,6,7,10]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,True]

test_input = { "s": "leubdglmbglleudm", "queries": [[1,3,9,14],[2,6,13,14]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "ooxuznriuzrooixn", "queries": [[1,3,10,12],[1,4,9,13]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "nlaonaphinpnalohai", "queries": [[2,5,13,13],[2,7,9,14]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "rujokutobuttlysjusrtltuobkoytu", "queries": [[5,6,18,23],[10,13,15,26]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False]

test_input = { "s": "bb", "queries": [[0,0,1,1],[0,0,1,1],[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "cc", "queries": [[0,0,1,1],[0,0,1,1],[0,0,1,1]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "dbdb", "queries": [[0,0,2,2],[1,1,3,3],[0,1,2,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,True]

test_input = { "s": "ebbe", "queries": [[0,1,3,3],[1,1,2,2],[0,0,2,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "acacaa", "queries": [[0,1,5,5],[1,1,4,4],[1,2,3,4]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,True]

test_input = { "s": "bbaabb", "queries": [[0,1,4,5],[0,2,3,5],[2,2,5,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "bbebbe", "queries": [[0,1,3,5],[2,2,4,5],[0,1,5,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,False,False]

test_input = { "s": "ddaadd", "queries": [[1,1,4,4],[0,0,4,4],[0,2,3,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "nlhhln", "queries": [[2,2,4,5],[1,2,5,5],[2,2,3,3]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "zbebez", "queries": [[0,2,5,5],[1,1,3,5],[0,2,4,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "cbcbbcbc", "queries": [[0,2,7,7],[1,2,4,7],[0,2,4,5]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,True]

test_input = { "s": "deceecde", "queries": [[3,3,6,7],[1,2,4,5],[2,3,7,7]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,False,False]

test_input = { "s": "fydyfyyd", "queries": [[0,2,4,6],[1,3,4,7],[2,3,6,7]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [True,True,False]

test_input = { "s": "dccabcdbca", "queries": [[1,3,5,8],[2,4,7,7],[0,2,6,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "eacbdeacbd", "queries": [[4,4,8,9],[3,4,7,9],[0,0,6,8]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "eddaaedada", "queries": [[0,1,7,8],[0,1,7,8],[0,3,7,9]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "vvsbgsvgbv", "queries": [[0,1,6,9],[2,3,8,9],[0,0,6,7]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "sukesivksseuiv", "queries": [[2,3,11,13],[5,5,7,13],[2,5,8,13]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,True,False]

test_input = { "s": "pbcjpsfxwtbcfjwpsptx", "queries": [[0,4,13,13],[5,5,15,18],[2,3,13,18]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "natvhtruvwyutyvvnarhwt", "queries": [[5,7,14,21],[0,8,11,19],[2,8,11,14]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "yjsjywxbriejyxieysrwbj", "queries": [[4,5,15,19],[1,9,12,17],[3,6,12,18]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "ellaghdbmazdallhmegabddz", "queries": [[4,6,13,19],[4,11,17,17],[7,10,13,16]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "wcfnhuaulqxbuuxafcwhnbql", "queries": [[5,11,13,18],[7,8,18,21],[3,6,21,23]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]

test_input = { "s": "qyioinjmvpgpropimvqiygrnjp", "queries": [[1,4,15,25],[1,8,19,22],[4,9,18,23]] }
assert my_solution.canMakePalindromeQueries(**test_input) == [False,False,False]


minimum-number-game

Minimum Number Game

Prompt:
"""
You are given a 0-indexed integer array nums of even length and there is also an empty array arr. Alice and Bob decided to play a game where in every round Alice and Bob will do one move. The rules of the game are as follows:

Every round, first Alice will remove the minimum element from nums, and then Bob does the same.
Now, first Bob will append the removed element in the array arr, and then Alice does the same.
The game continues until nums becomes empty.

Return the resulting array arr.

Example 1:

Input: nums = [5,4,2,3]
Output: [3,2,5,4]
Explanation: In round one, first Alice removes 2 and then Bob removes 3. Then in arr firstly Bob appends 3 and then Alice appends 2. So arr = [3,2].
At the begining of round two, nums = [5,4]. Now, first Alice removes 4 and then Bob removes 5. Then both append in arr which becomes [3,2,5,4].

Example 2:

Input: nums = [2,5]
Output: [5,2]
Explanation: In round one, first Alice removes 2 and then Bob removes 5. Then in arr firstly Bob appends and then Alice appends. So arr = [5,2].

Constraints:

1 <= nums.length <= 100
1 <= nums[i] <= 100
nums.length % 2 == 0
"""
class Solution:
    def numberGame(self, nums: List[int]) -> List[int]:

You are given a 0-indexed integer array nums of even length and there is also an empty array arr. Alice and Bob decided to play a game where in every round Alice and Bob will do one move. The rules of the game are as follows:

Every round, first Alice will remove the minimum element from nums, and then Bob does the same.
Now, first Bob will append the removed element in the array arr, and then Alice does the same.
The game continues until nums becomes empty.

Return the resulting array arr.

Example 1:

Input: nums = [5,4,2,3]
Output: [3,2,5,4]
Explanation: In round one, first Alice removes 2 and then Bob removes 3. Then in arr firstly Bob appends 3 and then Alice appends 2. So arr = [3,2].
At the begining of round two, nums = [5,4]. Now, first Alice removes 4 and then Bob removes 5. Then both append in arr which becomes [3,2,5,4].

Example 2:

Input: nums = [2,5]
Output: [5,2]
Explanation: In round one, first Alice removes 2 and then Bob removes 5. Then in arr firstly Bob appends and then Alice appends. So arr = [5,2].

Constraints:

1 <= nums.length <= 100
1 <= nums[i] <= 100
nums.length % 2 == 0

Please complete the code below to solve above prblem:
```python
class Solution:
    def numberGame(self, nums: List[int]) -> List[int]:

```

my_solution = Solution()

test_input = { "nums": [5,4,2,3] }
assert my_solution.numberGame(**test_input) == [3,2,5,4]

test_input = { "nums": [2,5] }
assert my_solution.numberGame(**test_input) == [5,2]

test_input = { "nums": [4,4,3,8] }
assert my_solution.numberGame(**test_input) == [4,3,8,4]

test_input = { "nums": [2,5,3,8] }
assert my_solution.numberGame(**test_input) == [3,2,8,5]

test_input = { "nums": [2,7,9,6,4,6] }
assert my_solution.numberGame(**test_input) == [4,2,6,6,9,7]

test_input = { "nums": [18,26,37,46,13,33,39,1,37,16] }
assert my_solution.numberGame(**test_input) == [13,1,18,16,33,26,37,37,46,39]

test_input = { "nums": [17,2,4,11,14,18] }
assert my_solution.numberGame(**test_input) == [4,2,14,11,18,17]

test_input = { "nums": [20,30,12,3,11,17,32,12] }
assert my_solution.numberGame(**test_input) == [11,3,12,12,20,17,32,30]

test_input = { "nums": [9,32,6,11,11,39,18,29,44,29] }
assert my_solution.numberGame(**test_input) == [9,6,11,11,29,18,32,29,44,39]

test_input = { "nums": [7,2,3,4] }
assert my_solution.numberGame(**test_input) == [3,2,7,4]

test_input = { "nums": [8,7,1,3] }
assert my_solution.numberGame(**test_input) == [3,1,8,7]

test_input = { "nums": [2,6,6,6] }
assert my_solution.numberGame(**test_input) == [6,2,6,6]

test_input = { "nums": [1,2] }
assert my_solution.numberGame(**test_input) == [2,1]

test_input = { "nums": [4,1,1,3] }
assert my_solution.numberGame(**test_input) == [1,1,4,3]

test_input = { "nums": [13,12,18,11,15,28,26,2] }
assert my_solution.numberGame(**test_input) == [11,2,13,12,18,15,28,26]

test_input = { "nums": [14,30,29,3,23,21,26,23] }
assert my_solution.numberGame(**test_input) == [14,3,23,21,26,23,30,29]

test_input = { "nums": [1,1] }
assert my_solution.numberGame(**test_input) == [1,1]

test_input = { "nums": [2,1] }
assert my_solution.numberGame(**test_input) == [2,1]

test_input = { "nums": [12,1,28,23,2,31,11,26] }
assert my_solution.numberGame(**test_input) == [2,1,12,11,26,23,31,28]

test_input = { "nums": [21,11,37,1,40,50,49,45,28,47] }
assert my_solution.numberGame(**test_input) == [11,1,28,21,40,37,47,45,50,49]

test_input = { "nums": [25,22,31,7,30,9,9,18] }
assert my_solution.numberGame(**test_input) == [9,7,18,9,25,22,31,30]

test_input = { "nums": [2,4,10,9,16,9] }
assert my_solution.numberGame(**test_input) == [4,2,9,9,16,10]

test_input = { "nums": [5,2,3,5] }
assert my_solution.numberGame(**test_input) == [3,2,5,5]

test_input = { "nums": [6,44,37,6,28,44,30,36,25,24] }
assert my_solution.numberGame(**test_input) == [6,6,25,24,30,28,37,36,44,44]

test_input = { "nums": [17,10,6,14,10,18] }
assert my_solution.numberGame(**test_input) == [10,6,14,10,18,17]

test_input = { "nums": [40,24,23,29,37,26,39,34,39,23] }
assert my_solution.numberGame(**test_input) == [23,23,26,24,34,29,39,37,40,39]

test_input = { "nums": [2,2] }
assert my_solution.numberGame(**test_input) == [2,2]

test_input = { "nums": [33,5,31,43,48,18,31,11,19,8] }
assert my_solution.numberGame(**test_input) == [8,5,18,11,31,19,33,31,48,43]

test_input = { "nums": [37,46,42,19,10,8,43,10,40,13] }
assert my_solution.numberGame(**test_input) == [10,8,13,10,37,19,42,40,46,43]

test_input = { "nums": [2,19,8,22,1,27,29,7] }
assert my_solution.numberGame(**test_input) == [2,1,8,7,22,19,29,27]

test_input = { "nums": [2,3,2,3] }
assert my_solution.numberGame(**test_input) == [2,2,3,3]

test_input = { "nums": [1,4,7,14,8,14] }
assert my_solution.numberGame(**test_input) == [4,1,8,7,14,14]

test_input = { "nums": [28,47,36,34,19,7,40,46,33,43] }
assert my_solution.numberGame(**test_input) == [19,7,33,28,36,34,43,40,47,46]

test_input = { "nums": [29,41,20,22,16,27,22,44,10,47] }
assert my_solution.numberGame(**test_input) == [16,10,22,20,27,22,41,29,47,44]

test_input = { "nums": [14,6,40,19,47,46,34,27,28,10] }
assert my_solution.numberGame(**test_input) == [10,6,19,14,28,27,40,34,47,46]

test_input = { "nums": [42,43,50,43,36,26,16,12,3,2] }
assert my_solution.numberGame(**test_input) == [3,2,16,12,36,26,43,42,50,43]

test_input = { "nums": [1,7,24,24,23,32,28,2] }
assert my_solution.numberGame(**test_input) == [2,1,23,7,24,24,32,28]

test_input = { "nums": [20,19,16,16,19,29,21,5] }
assert my_solution.numberGame(**test_input) == [16,5,19,16,20,19,29,21]

test_input = { "nums": [20,9,29,29,17,39,27,44,1,8] }
assert my_solution.numberGame(**test_input) == [8,1,17,9,27,20,29,29,44,39]

test_input = { "nums": [14,11,12,18,9,15] }
assert my_solution.numberGame(**test_input) == [11,9,14,12,18,15]

test_input = { "nums": [17,22,2,35,15,19,25,5,33,44] }
assert my_solution.numberGame(**test_input) == [5,2,17,15,22,19,33,25,44,35]

test_input = { "nums": [22,3,26,15,1,5,14,28] }
assert my_solution.numberGame(**test_input) == [3,1,14,5,22,15,28,26]

test_input = { "nums": [5,24,3,2,17,9,2,4] }
assert my_solution.numberGame(**test_input) == [2,2,4,3,9,5,24,17]

test_input = { "nums": [2,6,4,7] }
assert my_solution.numberGame(**test_input) == [4,2,7,6]

test_input = { "nums": [1,33,29,21,25,14,26,35,34,30] }
assert my_solution.numberGame(**test_input) == [14,1,25,21,29,26,33,30,35,34]

test_input = { "nums": [50,25,42,41,16,23,47,31,23,16] }
assert my_solution.numberGame(**test_input) == [16,16,23,23,31,25,42,41,50,47]

test_input = { "nums": [31,31,31,12,24,17,11,3,33,13] }
assert my_solution.numberGame(**test_input) == [11,3,13,12,24,17,31,31,33,31]

test_input = { "nums": [8,3,2,7] }
assert my_solution.numberGame(**test_input) == [3,2,8,7]

test_input = { "nums": [8,2,8,6] }
assert my_solution.numberGame(**test_input) == [6,2,8,8]

test_input = { "nums": [4,15,16,2,12,7] }
assert my_solution.numberGame(**test_input) == [4,2,12,7,16,15]

test_input = { "nums": [5,4,2,4] }
assert my_solution.numberGame(**test_input) == [4,2,5,4]

test_input = { "nums": [17,13,7,12,19,15,6,22] }
assert my_solution.numberGame(**test_input) == [7,6,13,12,17,15,22,19]

test_input = { "nums": [2,15,12,16,12,13] }
assert my_solution.numberGame(**test_input) == [12,2,13,12,16,15]

test_input = { "nums": [3,15,18,16,6,7] }
assert my_solution.numberGame(**test_input) == [6,3,15,7,18,16]

test_input = { "nums": [4,7,11,6,11,8] }
assert my_solution.numberGame(**test_input) == [6,4,8,7,11,11]

test_input = { "nums": [1,7,24,23,16,21,9,11] }
assert my_solution.numberGame(**test_input) == [7,1,11,9,21,16,24,23]

test_input = { "nums": [6,3,10,16,15,6] }
assert my_solution.numberGame(**test_input) == [6,3,10,6,16,15]

test_input = { "nums": [17,9,1,29,30,5,31,26] }
assert my_solution.numberGame(**test_input) == [5,1,17,9,29,26,31,30]

test_input = { "nums": [3,6,4,14,9,15] }
assert my_solution.numberGame(**test_input) == [4,3,9,6,15,14]

test_input = { "nums": [37,38,24,15,12,1,37,19,38,11] }
assert my_solution.numberGame(**test_input) == [11,1,15,12,24,19,37,37,38,38]

test_input = { "nums": [17,3,8,12,6,9] }
assert my_solution.numberGame(**test_input) == [6,3,9,8,17,12]

test_input = { "nums": [32,23,27,32,24,26,24,27] }
assert my_solution.numberGame(**test_input) == [24,23,26,24,27,27,32,32]

test_input = { "nums": [15,16,26,6,5,9,22,14] }
assert my_solution.numberGame(**test_input) == [6,5,14,9,16,15,26,22]

test_input = { "nums": [14,21,13,10,2,16,14,30] }
assert my_solution.numberGame(**test_input) == [10,2,14,13,16,14,30,21]

test_input = { "nums": [1,6,30,1,13,25,18,1] }
assert my_solution.numberGame(**test_input) == [1,1,6,1,18,13,30,25]

test_input = { "nums": [32,12,17,32,11,25,22,18,10,1] }
assert my_solution.numberGame(**test_input) == [10,1,12,11,18,17,25,22,32,32]

test_input = { "nums": [2,8,5,6] }
assert my_solution.numberGame(**test_input) == [5,2,8,6]

test_input = { "nums": [27,3,10,25,10,7,15,16] }
assert my_solution.numberGame(**test_input) == [7,3,10,10,16,15,27,25]

test_input = { "nums": [5,18,19,25,13,21,16,7] }
assert my_solution.numberGame(**test_input) == [7,5,16,13,19,18,25,21]

test_input = { "nums": [8,6,6,8] }
assert my_solution.numberGame(**test_input) == [6,6,8,8]

test_input = { "nums": [23,15,39,9,19,10,6,9,33,28] }
assert my_solution.numberGame(**test_input) == [9,6,10,9,19,15,28,23,39,33]

test_input = { "nums": [16,42,47,16,31,39,8,26,50,33] }
assert my_solution.numberGame(**test_input) == [16,8,26,16,33,31,42,39,50,47]

test_input = { "nums": [4,31,9,2,4,28,28,12] }
assert my_solution.numberGame(**test_input) == [4,2,9,4,28,12,31,28]

test_input = { "nums": [9,5,8,11,4,7] }
assert my_solution.numberGame(**test_input) == [5,4,8,7,11,9]

test_input = { "nums": [44,2,23,3,7,2,36,33,7,21] }
assert my_solution.numberGame(**test_input) == [2,2,7,3,21,7,33,23,44,36]

test_input = { "nums": [19,9,4,7,29,22,50,28,2,40] }
assert my_solution.numberGame(**test_input) == [4,2,9,7,22,19,29,28,50,40]

test_input = { "nums": [4,5,5,5] }
assert my_solution.numberGame(**test_input) == [5,4,5,5]

test_input = { "nums": [42,6,44,47,11,6,30,38,41,43] }
assert my_solution.numberGame(**test_input) == [6,6,30,11,41,38,43,42,47,44]

test_input = { "nums": [28,4,47,1,7,35,10,10,5,8] }
assert my_solution.numberGame(**test_input) == [4,1,7,5,10,8,28,10,47,35]

test_input = { "nums": [12,20,14,46,22,1,42,50,47,47] }
assert my_solution.numberGame(**test_input) == [12,1,20,14,42,22,47,46,50,47]

test_input = { "nums": [37,13,1,38,28,46,18,22,12,7] }
assert my_solution.numberGame(**test_input) == [7,1,13,12,22,18,37,28,46,38]

test_input = { "nums": [36,41,5,33,5,30,33,31,6,45] }
assert my_solution.numberGame(**test_input) == [5,5,30,6,33,31,36,33,45,41]

test_input = { "nums": [13,50,42,24,47,41,8,26,34,3] }
assert my_solution.numberGame(**test_input) == [8,3,24,13,34,26,42,41,50,47]

test_input = { "nums": [24,39,26,46,47,9,33,6,33,40] }
assert my_solution.numberGame(**test_input) == [9,6,26,24,33,33,40,39,47,46]

test_input = { "nums": [14,13,17,14,12,15,6,32] }
assert my_solution.numberGame(**test_input) == [12,6,14,13,15,14,32,17]

test_input = { "nums": [46,50,35,11,14,44,17,45,23,34] }
assert my_solution.numberGame(**test_input) == [14,11,23,17,35,34,45,44,50,46]

test_input = { "nums": [8,27,19,7,10,12,14,50,45,14] }
assert my_solution.numberGame(**test_input) == [8,7,12,10,14,14,27,19,50,45]

test_input = { "nums": [9,8,5,7,10,9] }
assert my_solution.numberGame(**test_input) == [7,5,9,8,10,9]

test_input = { "nums": [5,5,3,7] }
assert my_solution.numberGame(**test_input) == [5,3,7,5]

test_input = { "nums": [26,21,7,13,3,10,9,15] }
assert my_solution.numberGame(**test_input) == [7,3,10,9,15,13,26,21]

test_input = { "nums": [8,5,8,3] }
assert my_solution.numberGame(**test_input) == [5,3,8,8]

test_input = { "nums": [18,1,16,18,13,3] }
assert my_solution.numberGame(**test_input) == [3,1,16,13,18,18]

test_input = { "nums": [25,2,17,26,17,20,19,24] }
assert my_solution.numberGame(**test_input) == [17,2,19,17,24,20,26,25]

test_input = { "nums": [24,1,18,25,29,17,9,3] }
assert my_solution.numberGame(**test_input) == [3,1,17,9,24,18,29,25]

test_input = { "nums": [23,17,18,18,18,30,8,19] }
assert my_solution.numberGame(**test_input) == [17,8,18,18,19,18,30,23]

test_input = { "nums": [12,13,13,18,5,16] }
assert my_solution.numberGame(**test_input) == [12,5,13,13,18,16]

test_input = { "nums": [19,4,11,7,24,12,24,14] }
assert my_solution.numberGame(**test_input) == [7,4,12,11,19,14,24,24]

test_input = { "nums": [28,11,11,29,18,2,6,32] }
assert my_solution.numberGame(**test_input) == [6,2,11,11,28,18,32,29]

test_input = { "nums": [12,17,3,31,15,18,18,2] }
assert my_solution.numberGame(**test_input) == [3,2,15,12,18,17,31,18]

test_input = { "nums": [24,6,21,30,29,8,23,18] }
assert my_solution.numberGame(**test_input) == [8,6,21,18,24,23,30,29]