count-pairs-whose-sum-is-less-than-target

Count Pairs Whose Sum is Less than Target

Prompt:
"""
Given a 0-indexed integer array nums of length n and an integer target, return the number of pairs (i, j) where 0 <= i < j < n and nums[i] + nums[j] < target.

Example 1:

Input: nums = [-1,1,2,3,1], target = 2
Output: 3
Explanation: There are 3 pairs of indices that satisfy the conditions in the statement:
- (0, 1) since 0 < 1 and nums[0] + nums[1] = 0 < target
- (0, 2) since 0 < 2 and nums[0] + nums[2] = 1 < target
- (0, 4) since 0 < 4 and nums[0] + nums[4] = 0 < target
Note that (0, 3) is not counted since nums[0] + nums[3] is not strictly less than the target.

Example 2:

Input: nums = [-6,2,5,-2,-7,-1,3], target = -2
Output: 10
Explanation: There are 10 pairs of indices that satisfy the conditions in the statement:
- (0, 1) since 0 < 1 and nums[0] + nums[1] = -4 < target
- (0, 3) since 0 < 3 and nums[0] + nums[3] = -8 < target
- (0, 4) since 0 < 4 and nums[0] + nums[4] = -13 < target
- (0, 5) since 0 < 5 and nums[0] + nums[5] = -7 < target
- (0, 6) since 0 < 6 and nums[0] + nums[6] = -3 < target
- (1, 4) since 1 < 4 and nums[1] + nums[4] = -5 < target
- (3, 4) since 3 < 4 and nums[3] + nums[4] = -9 < target
- (3, 5) since 3 < 5 and nums[3] + nums[5] = -3 < target
- (4, 5) since 4 < 5 and nums[4] + nums[5] = -8 < target
- (4, 6) since 4 < 6 and nums[4] + nums[6] = -4 < target

Constraints:

 * 1 <= nums.length == n <= 50
 * -50 <= nums[i], target <= 50
"""
class Solution:
    def countPairs(self, nums: List[int], target: int) -> int:

Given a 0-indexed integer array nums of length n and an integer target, return the number of pairs (i, j) where 0 <= i < j < n and nums[i] + nums[j] < target.

Example 1:

Input: nums = [-1,1,2,3,1], target = 2
Output: 3
Explanation: There are 3 pairs of indices that satisfy the conditions in the statement:
- (0, 1) since 0 < 1 and nums[0] + nums[1] = 0 < target
- (0, 2) since 0 < 2 and nums[0] + nums[2] = 1 < target
- (0, 4) since 0 < 4 and nums[0] + nums[4] = 0 < target
Note that (0, 3) is not counted since nums[0] + nums[3] is not strictly less than the target.

Example 2:

Input: nums = [-6,2,5,-2,-7,-1,3], target = -2
Output: 10
Explanation: There are 10 pairs of indices that satisfy the conditions in the statement:
- (0, 1) since 0 < 1 and nums[0] + nums[1] = -4 < target
- (0, 3) since 0 < 3 and nums[0] + nums[3] = -8 < target
- (0, 4) since 0 < 4 and nums[0] + nums[4] = -13 < target
- (0, 5) since 0 < 5 and nums[0] + nums[5] = -7 < target
- (0, 6) since 0 < 6 and nums[0] + nums[6] = -3 < target
- (1, 4) since 1 < 4 and nums[1] + nums[4] = -5 < target
- (3, 4) since 3 < 4 and nums[3] + nums[4] = -9 < target
- (3, 5) since 3 < 5 and nums[3] + nums[5] = -3 < target
- (4, 5) since 4 < 5 and nums[4] + nums[5] = -8 < target
- (4, 6) since 4 < 6 and nums[4] + nums[6] = -4 < target

Constraints:

 * 1 <= nums.length == n <= 50
 * -50 <= nums[i], target <= 50

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

```

my_solution = Solution()

test_input = { "nums": [-1,1,2,3,1], "target": 2 }
assert my_solution.countPairs(**test_input) == 3

test_input = { "nums": [-6,2,5,-2,-7,-1,3], "target": -2 }
assert my_solution.countPairs(**test_input) == 10

test_input = { "nums": [9,-5,-5,5,-5,-4,-6,6,-6], "target": 3 }
assert my_solution.countPairs(**test_input) == 27

test_input = { "nums": [-8,-5,5,-4,10], "target": 2 }
assert my_solution.countPairs(**test_input) == 6

test_input = { "nums": [-5,0,-7,-1,9,8,-9,9], "target": -14 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [6,-1,7,4,2,3], "target": 8 }
assert my_solution.countPairs(**test_input) == 8

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

test_input = { "nums": [-6,1,1,-1,-10,-7,1,-5,-4,0], "target": -15 }
assert my_solution.countPairs(**test_input) == 2

test_input = { "nums": [10,-2,-1,7,8,5,3,-4,-9], "target": -10 }
assert my_solution.countPairs(**test_input) == 2

test_input = { "nums": [3,8,-3,4,10,-6], "target": 1 }
assert my_solution.countPairs(**test_input) == 4

test_input = { "nums": [-4,-6,-7,8], "target": -13 }
assert my_solution.countPairs(**test_input) == 0

test_input = { "nums": [-4,0,10,8,-2], "target": 0 }
assert my_solution.countPairs(**test_input) == 3

test_input = { "nums": [-8,-5,-3,1,-7], "target": -6 }
assert my_solution.countPairs(**test_input) == 7

test_input = { "nums": [4,-8,-2,5,2,-9,6,5,-4], "target": -4 }
assert my_solution.countPairs(**test_input) == 9

test_input = { "nums": [-1,-5,4,4,-10], "target": -6 }
assert my_solution.countPairs(**test_input) == 2

test_input = { "nums": [-5,4,-6,-5,-10,-1,10,3], "target": 6 }
assert my_solution.countPairs(**test_input) == 24

test_input = { "nums": [-9,6,-4,10,1,8], "target": 11 }
assert my_solution.countPairs(**test_input) == 11

test_input = { "nums": [-10,-6,-8,-9,6,6,-6,-6,-3], "target": -2 }
assert my_solution.countPairs(**test_input) == 25

test_input = { "nums": [-7,7,6,-9,-4,10,8,-8,2,2], "target": -1 }
assert my_solution.countPairs(**test_input) == 17

test_input = { "nums": [0,-1,0,-6,-9], "target": -9 }
assert my_solution.countPairs(**test_input) == 2

test_input = { "nums": [8,-10,-9,6,-3,5,-2,-2,-7], "target": -4 }
assert my_solution.countPairs(**test_input) == 15

test_input = { "nums": [-1,3,8,3], "target": 2 }
assert my_solution.countPairs(**test_input) == 0

test_input = { "nums": [7,2,9,-10,-4,4,-3,0], "target": -20 }
assert my_solution.countPairs(**test_input) == 0

test_input = { "nums": [6,4,1,-7], "target": 7 }
assert my_solution.countPairs(**test_input) == 4

test_input = { "nums": [3,8,6,-2,6,1,7], "target": 7 }
assert my_solution.countPairs(**test_input) == 7

test_input = { "nums": [1,3,-10,5,-8,0,-5,-9], "target": -7 }
assert my_solution.countPairs(**test_input) == 11

test_input = { "nums": [-6,9,2,4,-9,2,4,-6,6,-9], "target": 11 }
assert my_solution.countPairs(**test_input) == 40

test_input = { "nums": [-10,-7,-5,-1,2,4,-6,6], "target": -3 }
assert my_solution.countPairs(**test_input) == 15

test_input = { "nums": [-1,0,1,9,-2,-8,-8,7], "target": 1 }
assert my_solution.countPairs(**test_input) == 16

test_input = { "nums": [1,9,3,2,9,-5,6,0,-6,6], "target": 9 }
assert my_solution.countPairs(**test_input) == 29

test_input = { "nums": [-3,-3,-4,1,4,9], "target": 6 }
assert my_solution.countPairs(**test_input) == 11

test_input = { "nums": [-10,3,-5,2,-10,7,9], "target": 4 }
assert my_solution.countPairs(**test_input) == 14

test_input = { "nums": [7,10,9,8,-9,1,-7,10,-4,2], "target": 4 }
assert my_solution.countPairs(**test_input) == 21

test_input = { "nums": [9,-9,0,5,4], "target": 14 }
assert my_solution.countPairs(**test_input) == 9

test_input = { "nums": [7,9,7,-10,-6,-8,-5], "target": 2 }
assert my_solution.countPairs(**test_input) == 14

test_input = { "nums": [8,-5,0,4], "target": 0 }
assert my_solution.countPairs(**test_input) == 2

test_input = { "nums": [5,2,-1,9,-1,-1], "target": 4 }
assert my_solution.countPairs(**test_input) == 6

test_input = { "nums": [-7,-4,3,9,10,5,-1,1,-7], "target": -4 }
assert my_solution.countPairs(**test_input) == 8

test_input = { "nums": [0,8,9,-9,8,-2,-1,2,5], "target": -1 }
assert my_solution.countPairs(**test_input) == 7

test_input = { "nums": [10,4,-9,8,-10,3], "target": -7 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [-6,-6,6,-4,-5,-1,10,-8,1], "target": -13 }
assert my_solution.countPairs(**test_input) == 2

test_input = { "nums": [7,3,-4,1,-9,-8,10,4,-1], "target": -2 }
assert my_solution.countPairs(**test_input) == 13

test_input = { "nums": [4,3,-3,1,-3,-1], "target": -2 }
assert my_solution.countPairs(**test_input) == 3

test_input = { "nums": [10,-8,-9,-7,2,-10,4,7,6,6], "target": 14 }
assert my_solution.countPairs(**test_input) == 41

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

test_input = { "nums": [-1,2,-3,-4,-10,-8,2], "target": -1 }
assert my_solution.countPairs(**test_input) == 16

test_input = { "nums": [-8,-9,-10,0,-5,-5], "target": -15 }
assert my_solution.countPairs(**test_input) == 3

test_input = { "nums": [-8,9,-10,2,-10,-6,-1,-8], "target": -4 }
assert my_solution.countPairs(**test_input) == 19

test_input = { "nums": [4,-7,8,7,-4,3,7,7,-2,-10], "target": 4 }
assert my_solution.countPairs(**test_input) == 25

test_input = { "nums": [6,3,4,5,-4], "target": 0 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [2,-4,5,3,7,10,9,-1,9,0], "target": 9 }
assert my_solution.countPairs(**test_input) == 23

test_input = { "nums": [-2,-5,9,-3,-8,5,-1,3,-9], "target": 1 }
assert my_solution.countPairs(**test_input) == 23

test_input = { "nums": [0,-2,-3,-1,-6,-7,3], "target": -10 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [10,4,-3,9,-8,6], "target": 14 }
assert my_solution.countPairs(**test_input) == 11

test_input = { "nums": [-10,-6,6,-7,1,-7,9,3,1], "target": 15 }
assert my_solution.countPairs(**test_input) == 35

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

test_input = { "nums": [-10,-8,8,-2], "target": 0 }
assert my_solution.countPairs(**test_input) == 4

test_input = { "nums": [-2,2,-7,-5,1,6,8], "target": 0 }
assert my_solution.countPairs(**test_input) == 9

test_input = { "nums": [4,-4,-5,-8,9], "target": -10 }
assert my_solution.countPairs(**test_input) == 2

test_input = { "nums": [-5,-4,-6,-7,9,-10,0,4,9,-1], "target": -7 }
assert my_solution.countPairs(**test_input) == 13

test_input = { "nums": [-10,-6,6,-3,10,-6,4,-8], "target": -9 }
assert my_solution.countPairs(**test_input) == 8

test_input = { "nums": [-8,-1,-9,1], "target": -17 }
assert my_solution.countPairs(**test_input) == 0

test_input = { "nums": [6,-4,2,1,10,-1], "target": 1 }
assert my_solution.countPairs(**test_input) == 4

test_input = { "nums": [9,4,-8,8,9,-4], "target": -16 }
assert my_solution.countPairs(**test_input) == 0

test_input = { "nums": [9,-4,8,-9,-2,-2], "target": -11 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [-7,1,3,7,6,3], "target": 10 }
assert my_solution.countPairs(**test_input) == 12

test_input = { "nums": [10,10,-2,-4], "target": 8 }
assert my_solution.countPairs(**test_input) == 3

test_input = { "nums": [-3,2,6,-6,9], "target": 3 }
assert my_solution.countPairs(**test_input) == 4

test_input = { "nums": [5,0,2,4,2,-7], "target": 2 }
assert my_solution.countPairs(**test_input) == 5

test_input = { "nums": [4,-5,-4,-2,-9,-6,-10,-10,2,-8], "target": -19 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [-10,10,-9,-2,3,-2,-7,-1,-6,7], "target": -17 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [-9,-9,3,7,-9,-10,2,3,-4], "target": -13 }
assert my_solution.countPairs(**test_input) == 7

test_input = { "nums": [-5,-4,-10,7], "target": 14 }
assert my_solution.countPairs(**test_input) == 6

test_input = { "nums": [-3,4,-6,-6,1,-10,-1,-8], "target": -11 }
assert my_solution.countPairs(**test_input) == 7

test_input = { "nums": [-7,1,-5,8,-7,-3,2,-2,-2,7], "target": -5 }
assert my_solution.countPairs(**test_input) == 14

test_input = { "nums": [8,0,-8,-8,-1,5], "target": 0 }
assert my_solution.countPairs(**test_input) == 8

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

test_input = { "nums": [8,-1,-5,7,7,5,-6,2], "target": -2 }
assert my_solution.countPairs(**test_input) == 5

test_input = { "nums": [-1,3,3,3,9], "target": 8 }
assert my_solution.countPairs(**test_input) == 6

test_input = { "nums": [-8,0,-1,-6,-9,2,3,1], "target": -9 }
assert my_solution.countPairs(**test_input) == 4

test_input = { "nums": [3,-3,-7,-6,-5,-2], "target": -2 }
assert my_solution.countPairs(**test_input) == 12

test_input = { "nums": [3,6,0,-4,-2,5], "target": -6 }
assert my_solution.countPairs(**test_input) == 0

test_input = { "nums": [-8,9,2,5,9,-4,3], "target": 6 }
assert my_solution.countPairs(**test_input) == 12

test_input = { "nums": [0,-6,-5,-8,-4,0,7], "target": 7 }
assert my_solution.countPairs(**test_input) == 19

test_input = { "nums": [0,9,2,-4], "target": -8 }
assert my_solution.countPairs(**test_input) == 0

test_input = { "nums": [-7,9,-3,-5,-9,-3,-8,-2,1,2], "target": -8 }
assert my_solution.countPairs(**test_input) == 15

test_input = { "nums": [4,10,-7,0,-3,5,9,6,8,-4], "target": 13 }
assert my_solution.countPairs(**test_input) == 34

test_input = { "nums": [2,-6,0,5,-9,-8,6,5], "target": -3 }
assert my_solution.countPairs(**test_input) == 11

test_input = { "nums": [-4,6,-2,10,-5,-7,-8,-1], "target": -5 }
assert my_solution.countPairs(**test_input) == 13

test_input = { "nums": [10,4,8,-1,9,-5,-1,-7,-9], "target": 19 }
assert my_solution.countPairs(**test_input) == 35

test_input = { "nums": [-6,5,3,-2,0,3,-7,-7], "target": -8 }
assert my_solution.countPairs(**test_input) == 5

test_input = { "nums": [-3,-1,7,4,-10,-6,2], "target": -4 }
assert my_solution.countPairs(**test_input) == 7

test_input = { "nums": [-7,8,3,-1,2,1,-10], "target": -7 }
assert my_solution.countPairs(**test_input) == 5

test_input = { "nums": [7,-3,-5,9,-10,-1,-3,-3,-3,1], "target": 6 }
assert my_solution.countPairs(**test_input) == 36

test_input = { "nums": [-5,-10,-7,-3,-2,-2], "target": -15 }
assert my_solution.countPairs(**test_input) == 1

test_input = { "nums": [-4,6,-9,-8,-9,-9], "target": -17 }
assert my_solution.countPairs(**test_input) == 3

test_input = { "nums": [-3,-8,-6,-4,-8,-10,-2,5,-2], "target": 1 }
assert my_solution.countPairs(**test_input) == 32

test_input = { "nums": [1,1,-6,8,2,10,-7,-9,-9], "target": -7 }
assert my_solution.countPairs(**test_input) == 10

test_input = { "nums": [-9,-6,-3,5,-4], "target": 2 }
assert my_solution.countPairs(**test_input) == 9

test_input = { "nums": [-5,10,-5,1,7,-8,8,-6,-6], "target": 2 }
assert my_solution.countPairs(**test_input) == 19


make-string-a-subsequence-using-cyclic-increments

Make String a Subsequence Using Cyclic Increments

Prompt:
"""
You are given two 0-indexed strings str1 and str2.

In an operation, you select a set of indices in str1, and for each index i in the set, increment str1[i] to the next character cyclically. That is 'a' becomes 'b', 'b' becomes 'c', and so on, and 'z' becomes 'a'.

Return true if it is possible to make str2 a subsequence of str1 by performing the operation at most once, and false otherwise.

Note: A subsequence of a string is a new string that is formed from the original string by deleting some (possibly none) of the characters without disturbing the relative positions of the remaining characters.

Example 1:

Input: str1 = "abc", str2 = "ad"
Output: true
Explanation: Select index 2 in str1.
Increment str1[2] to become 'd'.
Hence, str1 becomes "abd" and str2 is now a subsequence. Therefore, true is returned.

Example 2:

Input: str1 = "zc", str2 = "ad"
Output: true
Explanation: Select indices 0 and 1 in str1.
Increment str1[0] to become 'a'.
Increment str1[1] to become 'd'.
Hence, str1 becomes "ad" and str2 is now a subsequence. Therefore, true is returned.

Example 3:

Input: str1 = "ab", str2 = "d"
Output: false
Explanation: In this example, it can be shown that it is impossible to make str2 a subsequence of str1 using the operation at most once.
Therefore, false is returned.

Constraints:

 * 1 <= str1.length <= 105
 * 1 <= str2.length <= 105
 * str1 and str2 consist of only lowercase English letters.
"""
class Solution:
    def canMakeSubsequence(self, str1: str, str2: str) -> bool:

You are given two 0-indexed strings str1 and str2.

In an operation, you select a set of indices in str1, and for each index i in the set, increment str1[i] to the next character cyclically. That is 'a' becomes 'b', 'b' becomes 'c', and so on, and 'z' becomes 'a'.

Return true if it is possible to make str2 a subsequence of str1 by performing the operation at most once, and false otherwise.

Note: A subsequence of a string is a new string that is formed from the original string by deleting some (possibly none) of the characters without disturbing the relative positions of the remaining characters.

Example 1:

Input: str1 = "abc", str2 = "ad"
Output: true
Explanation: Select index 2 in str1.
Increment str1[2] to become 'd'.
Hence, str1 becomes "abd" and str2 is now a subsequence. Therefore, true is returned.

Example 2:

Input: str1 = "zc", str2 = "ad"
Output: true
Explanation: Select indices 0 and 1 in str1.
Increment str1[0] to become 'a'.
Increment str1[1] to become 'd'.
Hence, str1 becomes "ad" and str2 is now a subsequence. Therefore, true is returned.

Example 3:

Input: str1 = "ab", str2 = "d"
Output: false
Explanation: In this example, it can be shown that it is impossible to make str2 a subsequence of str1 using the operation at most once.
Therefore, false is returned.

Constraints:

 * 1 <= str1.length <= 105
 * 1 <= str2.length <= 105
 * str1 and str2 consist of only lowercase English letters.

Please complete the code below to solve above prblem:
```python
class Solution:
    def canMakeSubsequence(self, str1: str, str2: str) -> bool:

```

my_solution = Solution()

test_input = { "str1": "ab", "str2": "d" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "a", "str2": "d" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "abc", "str2": "ad" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "b", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "c", "str2": "b" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "c", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "zc", "str2": "ad" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "b", "str2": "c" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "c", "str2": "m" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "d", "str2": "h" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "f", "str2": "f" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "f", "str2": "g" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "d", "str2": "m" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "g", "str2": "g" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "h", "str2": "i" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "d", "str2": "x" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "i", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "j", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "j", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "f", "str2": "s" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "i", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "k", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "l", "str2": "d" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "k", "str2": "l" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "m", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "l", "str2": "l" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "m", "str2": "n" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "o", "str2": "p" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "o", "str2": "c" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "o", "str2": "n" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "p", "str2": "a" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "p", "str2": "s" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "q", "str2": "q" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "q", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "s", "str2": "f" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "s", "str2": "u" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "r", "str2": "s" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "t", "str2": "h" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "t", "str2": "k" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "t", "str2": "u" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "u", "str2": "w" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "u", "str2": "u" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "w", "str2": "y" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "u", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "at", "str2": "se" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "cl", "str2": "qs" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "v", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "w", "str2": "w" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "cq", "str2": "xz" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "y", "str2": "y" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ct", "str2": "xb" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "z", "str2": "a" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "fs", "str2": "rd" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "z", "str2": "z" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "gq", "str2": "kn" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "hq", "str2": "dk" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "dm", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "eh", "str2": "e" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ir", "str2": "ka" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "is", "str2": "af" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ja", "str2": "zz" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "jq", "str2": "zi" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ke", "str2": "qw" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "fp", "str2": "p" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "hz", "str2": "z" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ia", "str2": "a" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "lo", "str2": "fa" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "km", "str2": "l" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "mu", "str2": "za" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "np", "str2": "q" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "nh", "str2": "pa" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "oj", "str2": "j" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "oh", "str2": "hu" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "pg", "str2": "xb" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "uq", "str2": "v" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "pl", "str2": "yi" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ww", "str2": "x" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "xh", "str2": "x" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "yg", "str2": "y" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "px", "str2": "dh" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "rm", "str2": "au" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "se", "str2": "vs" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "yw", "str2": "w" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "st", "str2": "zf" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "dby", "str2": "z" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "sx", "str2": "fx" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "ei", "str2": "ei" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ff", "str2": "fg" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "to", "str2": "yv" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "tv", "str2": "ei" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "va", "str2": "ow" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "jc", "str2": "jd" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "jrg", "str2": "h" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "lf", "str2": "lg" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "agb", "str2": "vgz" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "amk", "str2": "nto" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "atd", "str2": "xrr" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "pc", "str2": "qc" }
assert my_solution.canMakeSubsequence(**test_input) == True

test_input = { "str1": "ayt", "str2": "nov" }
assert my_solution.canMakeSubsequence(**test_input) == False

test_input = { "str1": "qv", "str2": "rv" }
assert my_solution.canMakeSubsequence(**test_input) == True


sorting-three-groups

Sorting Three Groups

Prompt:
"""
You are given a 0-indexed integer array nums of length n.

The numbers from 0 to n - 1 are divided into three groups numbered from 1 to 3, where number i belongs to group nums[i]. Notice that some groups may be empty.

You are allowed to perform this operation any number of times:

 * Pick number x and change its group. More formally, change nums[x] to any number from 1 to 3.

A new array res is constructed using the following procedure:

 1. Sort the numbers in each group independently.
 2. Append the elements of groups 1, 2, and 3 to res in this order.

Array nums is called a beautiful array if the constructed array res is sorted in non-decreasing order.

Return the minimum number of operations to make nums a beautiful array.

Example 1:

Input: nums = [2,1,3,2,1]
Output: 3
Explanation: It's optimal to perform three operations:
1. change nums[0] to 1.
2. change nums[2] to 1.
3. change nums[3] to 1.
After performing the operations and sorting the numbers in each group, group 1 becomes equal to [0,1,2,3,4] and group 2 and group 3 become empty. Hence, res is equal to [0,1,2,3,4] which is sorted in non-decreasing order.
It can be proven that there is no valid sequence of less than three operations.

Example 2:

Input: nums = [1,3,2,1,3,3]
Output: 2
Explanation: It's optimal to perform two operations:
1. change nums[1] to 1.
2. change nums[2] to 1.
After performing the operations and sorting the numbers in each group, group 1 becomes equal to [0,1,2,3], group 2 becomes empty, and group 3 becomes equal to [4,5]. Hence, res is equal to [0,1,2,3,4,5] which is sorted in non-decreasing order.
It can be proven that there is no valid sequence of less than two operations.

Example 3:

Input: nums = [2,2,2,2,3,3]
Output: 0
Explanation: It's optimal to not perform operations.
After sorting the numbers in each group, group 1 becomes empty, group 2 becomes equal to [0,1,2,3] and group 3 becomes equal to [4,5]. Hence, res is equal to [0,1,2,3,4,5] which is sorted in non-decreasing order.

Constraints:

 * 1 <= nums.length <= 100
 * 1 <= nums[i] <= 3
"""
class Solution:
    def minimumOperations(self, nums: List[int]) -> int:

You are given a 0-indexed integer array nums of length n.

The numbers from 0 to n - 1 are divided into three groups numbered from 1 to 3, where number i belongs to group nums[i]. Notice that some groups may be empty.

You are allowed to perform this operation any number of times:

 * Pick number x and change its group. More formally, change nums[x] to any number from 1 to 3.

A new array res is constructed using the following procedure:

 1. Sort the numbers in each group independently.
 2. Append the elements of groups 1, 2, and 3 to res in this order.

Array nums is called a beautiful array if the constructed array res is sorted in non-decreasing order.

Return the minimum number of operations to make nums a beautiful array.

Example 1:

Input: nums = [2,1,3,2,1]
Output: 3
Explanation: It's optimal to perform three operations:
1. change nums[0] to 1.
2. change nums[2] to 1.
3. change nums[3] to 1.
After performing the operations and sorting the numbers in each group, group 1 becomes equal to [0,1,2,3,4] and group 2 and group 3 become empty. Hence, res is equal to [0,1,2,3,4] which is sorted in non-decreasing order.
It can be proven that there is no valid sequence of less than three operations.

Example 2:

Input: nums = [1,3,2,1,3,3]
Output: 2
Explanation: It's optimal to perform two operations:
1. change nums[1] to 1.
2. change nums[2] to 1.
After performing the operations and sorting the numbers in each group, group 1 becomes equal to [0,1,2,3], group 2 becomes empty, and group 3 becomes equal to [4,5]. Hence, res is equal to [0,1,2,3,4,5] which is sorted in non-decreasing order.
It can be proven that there is no valid sequence of less than two operations.

Example 3:

Input: nums = [2,2,2,2,3,3]
Output: 0
Explanation: It's optimal to not perform operations.
After sorting the numbers in each group, group 1 becomes empty, group 2 becomes equal to [0,1,2,3] and group 3 becomes equal to [4,5]. Hence, res is equal to [0,1,2,3,4,5] which is sorted in non-decreasing order.

Constraints:

 * 1 <= nums.length <= 100
 * 1 <= nums[i] <= 3

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

```

my_solution = Solution()

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

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

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

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

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

test_input = { "nums": [3] }
assert my_solution.minimumOperations(**test_input) == 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


number-of-beautiful-integers-in-the-range

Number of Beautiful Integers in the Range

Prompt:
"""
You are given positive integers low, high, and k.

A number is beautiful if it meets both of the following conditions:

 * The count of even digits in the number is equal to the count of odd digits.
 * The number is divisible by k.

Return the number of beautiful integers in the range [low, high].

Example 1:

Input: low = 10, high = 20, k = 3
Output: 2
Explanation: There are 2 beautiful integers in the given range: [12,18].
- 12 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 3.
- 18 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 3.
Additionally we can see that:
- 16 is not beautiful because it is not divisible by k = 3.
- 15 is not beautiful because it does not contain equal counts even and odd digits.
It can be shown that there are only 2 beautiful integers in the given range.

Example 2:

Input: low = 1, high = 10, k = 1
Output: 1
Explanation: There is 1 beautiful integer in the given range: [10].
- 10 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 1.
It can be shown that there is only 1 beautiful integer in the given range.

Example 3:

Input: low = 5, high = 5, k = 2
Output: 0
Explanation: There are 0 beautiful integers in the given range.
- 5 is not beautiful because it is not divisible by k = 2 and it does not contain equal even and odd digits.

Constraints:

 * 0 < low <= high <= 109
 * 0 < k <= 20
"""
class Solution:
    def numberOfBeautifulIntegers(self, low: int, high: int, k: int) -> int:

You are given positive integers low, high, and k.

A number is beautiful if it meets both of the following conditions:

 * The count of even digits in the number is equal to the count of odd digits.
 * The number is divisible by k.

Return the number of beautiful integers in the range [low, high].

Example 1:

Input: low = 10, high = 20, k = 3
Output: 2
Explanation: There are 2 beautiful integers in the given range: [12,18].
- 12 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 3.
- 18 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 3.
Additionally we can see that:
- 16 is not beautiful because it is not divisible by k = 3.
- 15 is not beautiful because it does not contain equal counts even and odd digits.
It can be shown that there are only 2 beautiful integers in the given range.

Example 2:

Input: low = 1, high = 10, k = 1
Output: 1
Explanation: There is 1 beautiful integer in the given range: [10].
- 10 is beautiful because it contains 1 odd digit and 1 even digit, and is divisible by k = 1.
It can be shown that there is only 1 beautiful integer in the given range.

Example 3:

Input: low = 5, high = 5, k = 2
Output: 0
Explanation: There are 0 beautiful integers in the given range.
- 5 is not beautiful because it is not divisible by k = 2 and it does not contain equal even and odd digits.

Constraints:

 * 0 < low <= high <= 109
 * 0 < k <= 20

Please complete the code below to solve above prblem:
```python
class Solution:
    def numberOfBeautifulIntegers(self, low: int, high: int, k: int) -> int:

```

my_solution = Solution()

test_input = { "low": 10, "high": 20, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 1, "high": 10, "k": 1 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 5, "high": 5, "k": 2 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 3, "high": 31, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 25, "high": 31, "k": 11 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 9, "high": 25, "k": 4 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 58, "high": 72, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 5, "high": 79, "k": 12 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 26, "high": 74, "k": 7 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 4

test_input = { "low": 36, "high": 65, "k": 7 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 12, "high": 84, "k": 8 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 4

test_input = { "low": 13, "high": 91, "k": 13 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 8, "high": 18, "k": 4 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 22, "high": 59, "k": 6 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 15, "high": 27, "k": 9 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 4, "high": 9, "k": 19 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 14, "high": 81, "k": 17 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 12, "high": 33, "k": 18 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 10, "high": 17, "k": 8 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 42, "high": 58, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 22, "high": 42, "k": 4 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 5, "high": 8, "k": 5 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 12, "high": 75, "k": 13 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 2, "high": 28, "k": 1 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 9

test_input = { "low": 29, "high": 35, "k": 17 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 13, "high": 21, "k": 9 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 1, "high": 13, "k": 15 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 12, "high": 21, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 47, "high": 72, "k": 13 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 1, "high": 35, "k": 12 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 38, "high": 52, "k": 4 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 10, "high": 74, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 11

test_input = { "low": 60, "high": 92, "k": 11 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 3, "high": 25, "k": 15 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 63, "high": 65, "k": 20 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 22, "high": 77, "k": 7 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 4

test_input = { "low": 1, "high": 1, "k": 4 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 28, "high": 73, "k": 20 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 21, "high": 32, "k": 6 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 43, "high": 43, "k": 11 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 31, "high": 68, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 1, "high": 8, "k": 4 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 47, "high": 100, "k": 18 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 45, "high": 84, "k": 19 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 31, "high": 80, "k": 11 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 14, "high": 14, "k": 5 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 21, "high": 88, "k": 10 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 11, "high": 42, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 6

test_input = { "low": 19, "high": 53, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 57, "high": 98, "k": 6 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 4

test_input = { "low": 57, "high": 69, "k": 9 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 17, "high": 64, "k": 1 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 23

test_input = { "low": 29, "high": 40, "k": 15 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 36, "high": 60, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 16, "high": 23, "k": 13 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 36, "high": 99, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 11

test_input = { "low": 23, "high": 83, "k": 4 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 6

test_input = { "low": 4, "high": 5, "k": 9 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 15, "high": 21, "k": 2 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 51, "high": 76, "k": 7 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 24, "high": 34, "k": 8 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 24, "high": 99, "k": 1 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 38

test_input = { "low": 37, "high": 63, "k": 10 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 19, "high": 23, "k": 6 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 35, "high": 70, "k": 17 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 3, "high": 18, "k": 19 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 30, "high": 64, "k": 12 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 3, "high": 12, "k": 9 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 14, "high": 21, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 19, "high": 21, "k": 12 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 54, "high": 78, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 24, "high": 36, "k": 20 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 54, "high": 58, "k": 13 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 74, "high": 88, "k": 12 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 45, "high": 58, "k": 14 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 51, "high": 99, "k": 8 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 8, "high": 26, "k": 13 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 12, "high": 92, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 15

test_input = { "low": 18, "high": 91, "k": 11 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 14, "high": 53, "k": 15 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 2

test_input = { "low": 4, "high": 10, "k": 11 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 7, "high": 24, "k": 5 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 1, "high": 25, "k": 8 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 7, "high": 20, "k": 15 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 51, "high": 92, "k": 1 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 21

test_input = { "low": 73, "high": 73, "k": 3 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 50, "high": 63, "k": 19 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 30, "high": 51, "k": 19 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 2, "high": 65, "k": 7 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 5

test_input = { "low": 49, "high": 87, "k": 20 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 3, "high": 6, "k": 1 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 16, "high": 17, "k": 6 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 17, "high": 32, "k": 16 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 13, "high": 14, "k": 6 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 25, "high": 42, "k": 11 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 18, "high": 46, "k": 5 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 3

test_input = { "low": 1, "high": 65, "k": 6 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 5

test_input = { "low": 6, "high": 43, "k": 15 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 1

test_input = { "low": 5, "high": 9, "k": 12 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 0

test_input = { "low": 1, "high": 75, "k": 9 }
assert my_solution.numberOfBeautifulIntegers(**test_input) == 7


max-pair-sum-in-an-array

Max Pair Sum in an Array

Prompt:
"""
You are given a 0-indexed integer array nums. You have to find the maximum sum of a pair of numbers from nums such that the maximum digit in both numbers are equal.

Return the maximum sum or -1 if no such pair exists.

Example 1:

Input: nums = [51,71,17,24,42]
Output: 88
Explanation:
For i = 1 and j = 2, nums[i] and nums[j] have equal maximum digits with a pair sum of 71 + 17 = 88.
For i = 3 and j = 4, nums[i] and nums[j] have equal maximum digits with a pair sum of 24 + 42 = 66.
It can be shown that there are no other pairs with equal maximum digits, so the answer is 88.

Example 2:

Input: nums = [1,2,3,4]
Output: -1
Explanation: No pair exists in nums with equal maximum digits.

Constraints:

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

You are given a 0-indexed integer array nums. You have to find the maximum sum of a pair of numbers from nums such that the maximum digit in both numbers are equal.

Return the maximum sum or -1 if no such pair exists.

Example 1:

Input: nums = [51,71,17,24,42]
Output: 88
Explanation:
For i = 1 and j = 2, nums[i] and nums[j] have equal maximum digits with a pair sum of 71 + 17 = 88.
For i = 3 and j = 4, nums[i] and nums[j] have equal maximum digits with a pair sum of 24 + 42 = 66.
It can be shown that there are no other pairs with equal maximum digits, so the answer is 88.

Example 2:

Input: nums = [1,2,3,4]
Output: -1
Explanation: No pair exists in nums with equal maximum digits.

Constraints:

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

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

```

my_solution = Solution()

test_input = { "nums": [51,71,17,24,42] }
assert my_solution.maxSum(**test_input) == 88

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

test_input = { "nums": [31,25,72,79,74] }
assert my_solution.maxSum(**test_input) == 146

test_input = { "nums": [84,91,18,59,27,9,81,33,17,58] }
assert my_solution.maxSum(**test_input) == 165

test_input = { "nums": [8,75,28,35,21,13,21] }
assert my_solution.maxSum(**test_input) == 42

test_input = { "nums": [35,52,74,92,25,65,77,1,73,32] }
assert my_solution.maxSum(**test_input) == 151

test_input = { "nums": [68,8,100,84,80,14,88] }
assert my_solution.maxSum(**test_input) == 172

test_input = { "nums": [53,98,69,64,40,60,23] }
assert my_solution.maxSum(**test_input) == 167

test_input = { "nums": [21,76] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [99,63,23,70,18,64] }
assert my_solution.maxSum(**test_input) == 127

test_input = { "nums": [21,21,78] }
assert my_solution.maxSum(**test_input) == 42

test_input = { "nums": [58,88,58,99,26,92] }
assert my_solution.maxSum(**test_input) == 191

test_input = { "nums": [10,24,25,20,92,73,63,51] }
assert my_solution.maxSum(**test_input) == 76

test_input = { "nums": [87,6,17,32,14,42,46,65,43,9] }
assert my_solution.maxSum(**test_input) == 111

test_input = { "nums": [96,46,85,19,29] }
assert my_solution.maxSum(**test_input) == 125

test_input = { "nums": [5,24] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [26,76,24,96,82,97,97,72,35] }
assert my_solution.maxSum(**test_input) == 194

test_input = { "nums": [77,82,30,94] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [76,94,51,82,3,89,52,96] }
assert my_solution.maxSum(**test_input) == 190

test_input = { "nums": [27,59,57,97,6,46,88,41,52,46] }
assert my_solution.maxSum(**test_input) == 156

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

test_input = { "nums": [62,69] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [63,24,1] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [55,46,4,61,78,21,85,52,83,77] }
assert my_solution.maxSum(**test_input) == 168

test_input = { "nums": [21,73,2,80,99,98,89] }
assert my_solution.maxSum(**test_input) == 197

test_input = { "nums": [94,63,50,43,62,14,83,91] }
assert my_solution.maxSum(**test_input) == 185

test_input = { "nums": [66,17,17,35,46,77,7,15,38] }
assert my_solution.maxSum(**test_input) == 112

test_input = { "nums": [61,90,34,29,68,35] }
assert my_solution.maxSum(**test_input) == 119

test_input = { "nums": [18,82,78] }
assert my_solution.maxSum(**test_input) == 160

test_input = { "nums": [8,71,2,59,70,12] }
assert my_solution.maxSum(**test_input) == 141

test_input = { "nums": [55,88,59] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [49,47,46,65,37,24,75,81,54,39] }
assert my_solution.maxSum(**test_input) == 122

test_input = { "nums": [73,79,48,45,57,73,51,78,67,78] }
assert my_solution.maxSum(**test_input) == 156

test_input = { "nums": [2,82,80,74,34,54,65] }
assert my_solution.maxSum(**test_input) == 162

test_input = { "nums": [9,62,85,95,36,62,21,38,16,12] }
assert my_solution.maxSum(**test_input) == 124

test_input = { "nums": [50,80,34,9,86,20,67,94,65,82] }
assert my_solution.maxSum(**test_input) == 168

test_input = { "nums": [79,74,92,84,37,19] }
assert my_solution.maxSum(**test_input) == 171

test_input = { "nums": [85,20,79] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [89,55,67,84,3] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [16,44,2,54,58,94] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [71,14,24,13,21,14,100,18,84,37] }
assert my_solution.maxSum(**test_input) == 108

test_input = { "nums": [13,26] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [82,30,53,72,56,94,72,67] }
assert my_solution.maxSum(**test_input) == 144

test_input = { "nums": [14,80,92,65,85,70] }
assert my_solution.maxSum(**test_input) == 165

test_input = { "nums": [81,39,43,31,53,43,87,19,93] }
assert my_solution.maxSum(**test_input) == 168

test_input = { "nums": [27,12,80,38,94,92,67,54,56,20] }
assert my_solution.maxSum(**test_input) == 186

test_input = { "nums": [52,32,24,6,3,89,100,3,5,3] }
assert my_solution.maxSum(**test_input) == 57

test_input = { "nums": [93,1,13,88,47,48,46,63] }
assert my_solution.maxSum(**test_input) == 136

test_input = { "nums": [3,55,40,93,97,37,31,31] }
assert my_solution.maxSum(**test_input) == 190

test_input = { "nums": [58,41,10,74,40,17] }
assert my_solution.maxSum(**test_input) == 91

test_input = { "nums": [58,33,78,53,88,1,15,44,82] }
assert my_solution.maxSum(**test_input) == 170

test_input = { "nums": [41,48,96,71,35,89,57,71] }
assert my_solution.maxSum(**test_input) == 185

test_input = { "nums": [43,4,69,29,37,50] }
assert my_solution.maxSum(**test_input) == 98

test_input = { "nums": [65,88,2] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [86,42,59,44,76,6] }
assert my_solution.maxSum(**test_input) == 86

test_input = { "nums": [29,96,1,10,27,78,56,62] }
assert my_solution.maxSum(**test_input) == 125

test_input = { "nums": [100,48,6] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [33,17] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [8,91] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [91,13,72,42,28] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [5,53,35,88,77,1,66,57] }
assert my_solution.maxSum(**test_input) == 134

test_input = { "nums": [50,27,52,70,67,60,65] }
assert my_solution.maxSum(**test_input) == 137

test_input = { "nums": [84,82,31,45,94,62,45,32] }
assert my_solution.maxSum(**test_input) == 166

test_input = { "nums": [61,61,61,23,47,34,21,6,65,25] }
assert my_solution.maxSum(**test_input) == 126

test_input = { "nums": [60,21,11,99] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [22,83,62,12,63,100,41,33] }
assert my_solution.maxSum(**test_input) == 125

test_input = { "nums": [92,58,85] }
assert my_solution.maxSum(**test_input) == 143

test_input = { "nums": [93,5,46,26,25,36,27,12,30] }
assert my_solution.maxSum(**test_input) == 82

test_input = { "nums": [52,30,16] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [22,57,33,26,76,14,67] }
assert my_solution.maxSum(**test_input) == 143

test_input = { "nums": [90,72,37,30] }
assert my_solution.maxSum(**test_input) == 109

test_input = { "nums": [44,87,16] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [19,12,52,8,3,58] }
assert my_solution.maxSum(**test_input) == 66

test_input = { "nums": [88,52,35,6,58,47,62,82,47,86] }
assert my_solution.maxSum(**test_input) == 174

test_input = { "nums": [84,1,48,76,16,10,11,60] }
assert my_solution.maxSum(**test_input) == 132

test_input = { "nums": [12,60,69,63,78,22,28] }
assert my_solution.maxSum(**test_input) == 123

test_input = { "nums": [16,28,82,77,41,22] }
assert my_solution.maxSum(**test_input) == 110

test_input = { "nums": [97,31,63,2,94,14,47] }
assert my_solution.maxSum(**test_input) == 191

test_input = { "nums": [93,100,45,74,31,41,84,90,18,21] }
assert my_solution.maxSum(**test_input) == 183

test_input = { "nums": [21,12,38,64,57,24] }
assert my_solution.maxSum(**test_input) == 33

test_input = { "nums": [33,17,99,2,58,59,72,9,62] }
assert my_solution.maxSum(**test_input) == 158

test_input = { "nums": [36,11,23,98,14,89,90,53] }
assert my_solution.maxSum(**test_input) == 188

test_input = { "nums": [57,90,5,78,84,51] }
assert my_solution.maxSum(**test_input) == 162

test_input = { "nums": [73,73,76,48,30] }
assert my_solution.maxSum(**test_input) == 149

test_input = { "nums": [2,74,37,75] }
assert my_solution.maxSum(**test_input) == 149

test_input = { "nums": [84,35,65,12] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [95,46,23,81,35] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [64,76,46,54,64,94,90,95] }
assert my_solution.maxSum(**test_input) == 189

test_input = { "nums": [77,52,74,84,47,89,53] }
assert my_solution.maxSum(**test_input) == 151

test_input = { "nums": [29,31,52,12,89,88,10,18] }
assert my_solution.maxSum(**test_input) == 118

test_input = { "nums": [28,57,28,41,25,89,20] }
assert my_solution.maxSum(**test_input) == 56

test_input = { "nums": [31,28] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [51,1,98,73,84,11,100,100,75] }
assert my_solution.maxSum(**test_input) == 200

test_input = { "nums": [76,2,26,49,78,36,2,70,64] }
assert my_solution.maxSum(**test_input) == 146

test_input = { "nums": [34,63,21,49] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [35,19,1,21,11,59,38] }
assert my_solution.maxSum(**test_input) == 78

test_input = { "nums": [1,35,74,58,56,54,75] }
assert my_solution.maxSum(**test_input) == 149

test_input = { "nums": [20,49] }
assert my_solution.maxSum(**test_input) == -1

test_input = { "nums": [97,92,13,30] }
assert my_solution.maxSum(**test_input) == 189

test_input = { "nums": [89,49,10,36,37] }
assert my_solution.maxSum(**test_input) == 138


double-a-number-represented-as-a-linked-list

Double a Number Represented as a Linked List

Prompt:
"""
You are given the head of a non-empty linked list representing a non-negative integer without leading zeroes.

Return the head of the linked list after doubling it.

Example 1:

[https://assets.leetcode.com/uploads/2023/05/28/example.png]

Input: head = [1,8,9]
Output: [3,7,8]
Explanation: The figure above corresponds to the given linked list which represents the number 189. Hence, the returned linked list represents the number 189 * 2 = 378.

Example 2:

[https://assets.leetcode.com/uploads/2023/05/28/example2.png]

Input: head = [9,9,9]
Output: [1,9,9,8]
Explanation: The figure above corresponds to the given linked list which represents the number 999. Hence, the returned linked list reprersents the number 999 * 2 = 1998.

Constraints:

 * The number of nodes in the list is in the range [1, 104]
 * 0 <= Node.val <= 9
 * The input is generated such that the list represents a number that does not have leading zeros, except the number 0 itself.
"""
# Definition for singly-linked list.
class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next
class Solution:
    def doubleIt(self, head: Optional[ListNode]) -> Optional[ListNode]:

You are given the head of a non-empty linked list representing a non-negative integer without leading zeroes.

Return the head of the linked list after doubling it.

Example 1:

[https://assets.leetcode.com/uploads/2023/05/28/example.png]

Input: head = [1,8,9]
Output: [3,7,8]
Explanation: The figure above corresponds to the given linked list which represents the number 189. Hence, the returned linked list represents the number 189 * 2 = 378.

Example 2:

[https://assets.leetcode.com/uploads/2023/05/28/example2.png]

Input: head = [9,9,9]
Output: [1,9,9,8]
Explanation: The figure above corresponds to the given linked list which represents the number 999. Hence, the returned linked list reprersents the number 999 * 2 = 1998.

Constraints:

 * The number of nodes in the list is in the range [1, 104]
 * 0 <= Node.val <= 9
 * The input is generated such that the list represents a number that does not have leading zeros, except the number 0 itself.

Please complete the code below to solve above prblem:
```python
# Definition for singly-linked list.
class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next
class Solution:
    def doubleIt(self, head: Optional[ListNode]) -> Optional[ListNode]:

```

my_solution = Solution()

_f1 = lambda lst: ListNode(lst[0], _f1(lst[1:])) if lst else None
_f2 = lambda node: [node.val] + _f2(node.next) if node else []

test_input = { "head": _f1([1,8,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [3,7,8]

test_input = { "head": _f1([9,9,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,9,9,8]

test_input = { "head": _f1([0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [0]

test_input = { "head": _f1([1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [2]

test_input = { "head": _f1([2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [4]

test_input = { "head": _f1([3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [6]

test_input = { "head": _f1([4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [8]

test_input = { "head": _f1([5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,0]

test_input = { "head": _f1([6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,2]

test_input = { "head": _f1([7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,4]

test_input = { "head": _f1([8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,6]

test_input = { "head": _f1([9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,8]

test_input = { "head": _f1([1,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [2,0]

test_input = { "head": _f1([1,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [2,2]

test_input = { "head": _f1([1,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [2,4]

test_input = { "head": _f1([1,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [2,6]

test_input = { "head": _f1([1,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [2,8]

test_input = { "head": _f1([1,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [3,0]

test_input = { "head": _f1([1,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [3,2]

test_input = { "head": _f1([1,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [3,4]

test_input = { "head": _f1([1,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [3,6]

test_input = { "head": _f1([1,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [3,8]

test_input = { "head": _f1([2,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [4,0]

test_input = { "head": _f1([2,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [4,2]

test_input = { "head": _f1([2,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [4,4]

test_input = { "head": _f1([2,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [4,6]

test_input = { "head": _f1([2,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [4,8]

test_input = { "head": _f1([2,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [5,0]

test_input = { "head": _f1([2,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [5,2]

test_input = { "head": _f1([2,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [5,4]

test_input = { "head": _f1([2,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [5,6]

test_input = { "head": _f1([2,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [5,8]

test_input = { "head": _f1([3,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [6,0]

test_input = { "head": _f1([3,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [6,2]

test_input = { "head": _f1([3,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [6,4]

test_input = { "head": _f1([3,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [6,6]

test_input = { "head": _f1([3,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [6,8]

test_input = { "head": _f1([3,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [7,0]

test_input = { "head": _f1([3,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [7,2]

test_input = { "head": _f1([3,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [7,4]

test_input = { "head": _f1([3,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [7,6]

test_input = { "head": _f1([3,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [7,8]

test_input = { "head": _f1([4,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [8,0]

test_input = { "head": _f1([4,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [8,2]

test_input = { "head": _f1([4,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [8,4]

test_input = { "head": _f1([4,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [8,6]

test_input = { "head": _f1([4,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [8,8]

test_input = { "head": _f1([4,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [9,0]

test_input = { "head": _f1([4,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [9,2]

test_input = { "head": _f1([4,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [9,4]

test_input = { "head": _f1([4,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [9,6]

test_input = { "head": _f1([4,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [9,8]

test_input = { "head": _f1([5,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,0,0]

test_input = { "head": _f1([5,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,0,2]

test_input = { "head": _f1([5,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,0,4]

test_input = { "head": _f1([5,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,0,6]

test_input = { "head": _f1([5,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,0,8]

test_input = { "head": _f1([5,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,1,0]

test_input = { "head": _f1([5,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,1,2]

test_input = { "head": _f1([5,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,1,4]

test_input = { "head": _f1([5,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,1,6]

test_input = { "head": _f1([5,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,1,8]

test_input = { "head": _f1([6,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,2,0]

test_input = { "head": _f1([6,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,2,2]

test_input = { "head": _f1([6,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,2,4]

test_input = { "head": _f1([6,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,2,6]

test_input = { "head": _f1([6,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,2,8]

test_input = { "head": _f1([6,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,3,0]

test_input = { "head": _f1([6,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,3,2]

test_input = { "head": _f1([6,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,3,4]

test_input = { "head": _f1([6,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,3,6]

test_input = { "head": _f1([6,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,3,8]

test_input = { "head": _f1([7,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,4,0]

test_input = { "head": _f1([7,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,4,2]

test_input = { "head": _f1([7,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,4,4]

test_input = { "head": _f1([7,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,4,6]

test_input = { "head": _f1([7,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,4,8]

test_input = { "head": _f1([7,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,5,0]

test_input = { "head": _f1([7,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,5,2]

test_input = { "head": _f1([7,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,5,4]

test_input = { "head": _f1([7,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,5,6]

test_input = { "head": _f1([7,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,5,8]

test_input = { "head": _f1([8,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,6,0]

test_input = { "head": _f1([8,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,6,2]

test_input = { "head": _f1([8,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,6,4]

test_input = { "head": _f1([8,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,6,6]

test_input = { "head": _f1([8,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,6,8]

test_input = { "head": _f1([8,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,7,0]

test_input = { "head": _f1([8,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,7,2]

test_input = { "head": _f1([8,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,7,4]

test_input = { "head": _f1([8,8]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,7,6]

test_input = { "head": _f1([8,9]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,7,8]

test_input = { "head": _f1([9,0]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,8,0]

test_input = { "head": _f1([9,1]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,8,2]

test_input = { "head": _f1([9,2]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,8,4]

test_input = { "head": _f1([9,3]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,8,6]

test_input = { "head": _f1([9,4]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,8,8]

test_input = { "head": _f1([9,5]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,9,0]

test_input = { "head": _f1([9,6]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,9,2]

test_input = { "head": _f1([9,7]) }
assert _f2(my_solution.doubleIt(**test_input)) == [1,9,4]


minimum-absolute-difference-between-elements-with-constraint

Minimum Absolute Difference Between Elements With Constraint

Prompt:
"""
You are given a 0-indexed integer array nums and an integer x.

Find the minimum absolute difference between two elements in the array that are at least x indices apart.

In other words, find two indices i and j such that abs(i - j) >= x and abs(nums[i] - nums[j]) is minimized.

Return an integer denoting the minimum absolute difference between two elements that are at least x indices apart.

Example 1:

Input: nums = [4,3,2,4], x = 2
Output: 0
Explanation: We can select nums[0] = 4 and nums[3] = 4.
They are at least 2 indices apart, and their absolute difference is the minimum, 0.
It can be shown that 0 is the optimal answer.

Example 2:

Input: nums = [5,3,2,10,15], x = 1
Output: 1
Explanation: We can select nums[1] = 3 and nums[2] = 2.
They are at least 1 index apart, and their absolute difference is the minimum, 1.
It can be shown that 1 is the optimal answer.

Example 3:

Input: nums = [1,2,3,4], x = 3
Output: 3
Explanation: We can select nums[0] = 1 and nums[3] = 4.
They are at least 3 indices apart, and their absolute difference is the minimum, 3.
It can be shown that 3 is the optimal answer.

Constraints:

 * 1 <= nums.length <= 105
 * 1 <= nums[i] <= 109
 * 0 <= x < nums.length
"""
class Solution:
    def minAbsoluteDifference(self, nums: List[int], x: int) -> int:

You are given a 0-indexed integer array nums and an integer x.

Find the minimum absolute difference between two elements in the array that are at least x indices apart.

In other words, find two indices i and j such that abs(i - j) >= x and abs(nums[i] - nums[j]) is minimized.

Return an integer denoting the minimum absolute difference between two elements that are at least x indices apart.

Example 1:

Input: nums = [4,3,2,4], x = 2
Output: 0
Explanation: We can select nums[0] = 4 and nums[3] = 4.
They are at least 2 indices apart, and their absolute difference is the minimum, 0.
It can be shown that 0 is the optimal answer.

Example 2:

Input: nums = [5,3,2,10,15], x = 1
Output: 1
Explanation: We can select nums[1] = 3 and nums[2] = 2.
They are at least 1 index apart, and their absolute difference is the minimum, 1.
It can be shown that 1 is the optimal answer.

Example 3:

Input: nums = [1,2,3,4], x = 3
Output: 3
Explanation: We can select nums[0] = 1 and nums[3] = 4.
They are at least 3 indices apart, and their absolute difference is the minimum, 3.
It can be shown that 3 is the optimal answer.

Constraints:

 * 1 <= nums.length <= 105
 * 1 <= nums[i] <= 109
 * 0 <= x < nums.length

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

```

my_solution = Solution()

test_input = { "nums": [4,3,2,4], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 0

test_input = { "nums": [5,3,2,10,15], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 1

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

test_input = { "nums": [1,67], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 66

test_input = { "nums": [7,398], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 391

test_input = { "nums": [12,141], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 129

test_input = { "nums": [21,75], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 54

test_input = { "nums": [22,147], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 125

test_input = { "nums": [25,197], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 172

test_input = { "nums": [27,275], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 248

test_input = { "nums": [37,192], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 155

test_input = { "nums": [41,163], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 122

test_input = { "nums": [45,49], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 4

test_input = { "nums": [48,195], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 147

test_input = { "nums": [68,68], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 0

test_input = { "nums": [71,4], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 67

test_input = { "nums": [72,169], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 97

test_input = { "nums": [74,62], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 12

test_input = { "nums": [75,1], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 74

test_input = { "nums": [76,49], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 27

test_input = { "nums": [88,72], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 16

test_input = { "nums": [99,370], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 271

test_input = { "nums": [103,39], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 64

test_input = { "nums": [109,99], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 10

test_input = { "nums": [111,161], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 50

test_input = { "nums": [113,117], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 4

test_input = { "nums": [119,184], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 65

test_input = { "nums": [122,118], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 4

test_input = { "nums": [123,13], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 110

test_input = { "nums": [123,162], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 39

test_input = { "nums": [126,69], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 57

test_input = { "nums": [127,18], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 109

test_input = { "nums": [127,346], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 219

test_input = { "nums": [132,110], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 22

test_input = { "nums": [134,23], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 111

test_input = { "nums": [136,150], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 14

test_input = { "nums": [139,215], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 76

test_input = { "nums": [153,3], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 150

test_input = { "nums": [156,67], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 89

test_input = { "nums": [160,168], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 8

test_input = { "nums": [161,93], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 68

test_input = { "nums": [164,81], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 83

test_input = { "nums": [167,83], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 84

test_input = { "nums": [174,58], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 116

test_input = { "nums": [174,102], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 72

test_input = { "nums": [175,137], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 38

test_input = { "nums": [176,99], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 77

test_input = { "nums": [178,179], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 1

test_input = { "nums": [228,359], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 131

test_input = { "nums": [243,280], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 37

test_input = { "nums": [283,62], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 221

test_input = { "nums": [288,149], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 139

test_input = { "nums": [293,278], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 15

test_input = { "nums": [327,425], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 98

test_input = { "nums": [337,187], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 150

test_input = { "nums": [346,160], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 186

test_input = { "nums": [347,369], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 22

test_input = { "nums": [355,199], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 156

test_input = { "nums": [413,311], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 102

test_input = { "nums": [417,320], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 97

test_input = { "nums": [418,131], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 287

test_input = { "nums": [3274,71], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 3203

test_input = { "nums": [5,14,81], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 76

test_input = { "nums": [9,25,15], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 6

test_input = { "nums": [9,113,136], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 23

test_input = { "nums": [13,19,12], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 1

test_input = { "nums": [13,94,59], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 46

test_input = { "nums": [14,111,16], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 2

test_input = { "nums": [17,173,69], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 52

test_input = { "nums": [24,39,28], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 4

test_input = { "nums": [32,129,93], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 36

test_input = { "nums": [33,18,131], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 15

test_input = { "nums": [36,19,27], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 9

test_input = { "nums": [40,18,17], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 1

test_input = { "nums": [43,49,20], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 23

test_input = { "nums": [44,186,163], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 119

test_input = { "nums": [56,23,158], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 33

test_input = { "nums": [62,37,182], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 120

test_input = { "nums": [63,116,12], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 51

test_input = { "nums": [66,345,278], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 212

test_input = { "nums": [67,81,165], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 98

test_input = { "nums": [70,184,70], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 0

test_input = { "nums": [73,106,172], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 33

test_input = { "nums": [74,199,57], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 17

test_input = { "nums": [83,14,14], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 0

test_input = { "nums": [86,1,129], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 43

test_input = { "nums": [87,194,107], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 20

test_input = { "nums": [88,75,122], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 34

test_input = { "nums": [93,96,28], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 3

test_input = { "nums": [95,86,132], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 37

test_input = { "nums": [96,41,24], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 17

test_input = { "nums": [116,6,3], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 3

test_input = { "nums": [120,102,184], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 18

test_input = { "nums": [123,113,20], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 10

test_input = { "nums": [125,14,141], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 16

test_input = { "nums": [126,2,180], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 54

test_input = { "nums": [136,24,114], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 22

test_input = { "nums": [136,177,98], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 38

test_input = { "nums": [136,177,123], "x": 1 }
assert my_solution.minAbsoluteDifference(**test_input) == 13

test_input = { "nums": [136,178,18], "x": 2 }
assert my_solution.minAbsoluteDifference(**test_input) == 118