minimum-number-of-pushes-to-type-word-i

Minimum Number of Pushes to Type Word I

Prompt:
"""
You are given a string word containing distinct lowercase English letters.
Telephone keypads have keys mapped with distinct collections of lowercase English letters, which can be used to form words by pushing them. For example, the key 2 is mapped with ["a","b","c"], we need to push the key one time to type "a", two times to type "b", and three times to type "c" .
It is allowed to remap the keys numbered 2 to 9 to distinct collections of letters. The keys can be remapped to any amount of letters, but each letter must be mapped to exactly one key. You need to find the minimum number of times the keys will be pushed to type the string word.
Return the minimum number of pushes needed to type word after remapping the keys.
An example mapping of letters to keys on a telephone keypad is given below. Note that 1, *, #, and 0 do not map to any letters.

Example 1:

Input: word = "abcde"
Output: 5
Explanation: The remapped keypad given in the image provides the minimum cost.
"a" -> one push on key 2
"b" -> one push on key 3
"c" -> one push on key 4
"d" -> one push on key 5
"e" -> one push on key 6
Total cost is 1 + 1 + 1 + 1 + 1 = 5.
It can be shown that no other mapping can provide a lower cost.

Example 2:

Input: word = "xycdefghij"
Output: 12
Explanation: The remapped keypad given in the image provides the minimum cost.
"x" -> one push on key 2
"y" -> two pushes on key 2
"c" -> one push on key 3
"d" -> two pushes on key 3
"e" -> one push on key 4
"f" -> one push on key 5
"g" -> one push on key 6
"h" -> one push on key 7
"i" -> one push on key 8
"j" -> one push on key 9
Total cost is 1 + 2 + 1 + 2 + 1 + 1 + 1 + 1 + 1 + 1 = 12.
It can be shown that no other mapping can provide a lower cost.

Constraints:

1 <= word.length <= 26
word consists of lowercase English letters.
All letters in word are distinct.
"""
class Solution:
    def minimumPushes(self, word: str) -> int:

You are given a string word containing distinct lowercase English letters.
Telephone keypads have keys mapped with distinct collections of lowercase English letters, which can be used to form words by pushing them. For example, the key 2 is mapped with ["a","b","c"], we need to push the key one time to type "a", two times to type "b", and three times to type "c" .
It is allowed to remap the keys numbered 2 to 9 to distinct collections of letters. The keys can be remapped to any amount of letters, but each letter must be mapped to exactly one key. You need to find the minimum number of times the keys will be pushed to type the string word.
Return the minimum number of pushes needed to type word after remapping the keys.
An example mapping of letters to keys on a telephone keypad is given below. Note that 1, *, #, and 0 do not map to any letters.

Example 1:

Input: word = "abcde"
Output: 5
Explanation: The remapped keypad given in the image provides the minimum cost.
"a" -> one push on key 2
"b" -> one push on key 3
"c" -> one push on key 4
"d" -> one push on key 5
"e" -> one push on key 6
Total cost is 1 + 1 + 1 + 1 + 1 = 5.
It can be shown that no other mapping can provide a lower cost.

Example 2:

Input: word = "xycdefghij"
Output: 12
Explanation: The remapped keypad given in the image provides the minimum cost.
"x" -> one push on key 2
"y" -> two pushes on key 2
"c" -> one push on key 3
"d" -> two pushes on key 3
"e" -> one push on key 4
"f" -> one push on key 5
"g" -> one push on key 6
"h" -> one push on key 7
"i" -> one push on key 8
"j" -> one push on key 9
Total cost is 1 + 2 + 1 + 2 + 1 + 1 + 1 + 1 + 1 + 1 = 12.
It can be shown that no other mapping can provide a lower cost.

Constraints:

1 <= word.length <= 26
word consists of lowercase English letters.
All letters in word are distinct.

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

```

my_solution = Solution()

test_input = { "word": "abcde" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "xycdefghij" }
assert my_solution.minimumPushes(**test_input) == 12

test_input = { "word": "b" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "d" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "e" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "f" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "g" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "h" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "i" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "k" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "n" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "o" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "q" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "u" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "v" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "w" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "x" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "bc" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "cu" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "dl" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "dn" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "ev" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "gn" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "gq" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "hu" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "jr" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "ln" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "lz" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "mv" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "mw" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "sw" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "wz" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "amw" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "bco" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "btx" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "cgp" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "cjq" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "clu" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "clx" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "crs" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "csz" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "dfp" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "htv" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "iwz" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "kux" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "nsv" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "svz" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "cfos" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "demr" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "dimo" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "dnpt" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "dorz" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "fgkn" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "fimn" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "hior" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "jkpy" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "jluv" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "knpv" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "kopu" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "lmpt" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "ltuw" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "qwxz" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "abhoz" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "aejwx" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "agjnr" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "aikmu" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "ajkmv" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "cflvx" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "dhstu" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "djmnx" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "dlovx" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "eglqy" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "ejntw" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "ekrsz" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "fopuz" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "jlnvz" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "jnstu" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "afikno" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "almsyz" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "bcehov" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "bdmprt" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "bfhmnu" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "bfhpty" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "bfjstu" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "cdfjmw" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "dfilps" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "dmswyz" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "dpqruw" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "fhmprz" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "gjqrvy" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "ijopsv" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "lmqrtz" }
assert my_solution.minimumPushes(**test_input) == 6

test_input = { "word": "bxnqpha" }
assert my_solution.minimumPushes(**test_input) == 7

test_input = { "word": "ekbfqat" }
assert my_solution.minimumPushes(**test_input) == 7

test_input = { "word": "esoizcx" }
assert my_solution.minimumPushes(**test_input) == 7

test_input = { "word": "fmteczo" }
assert my_solution.minimumPushes(**test_input) == 7

test_input = { "word": "lrywetm" }
assert my_solution.minimumPushes(**test_input) == 7

test_input = { "word": "lvbornx" }
assert my_solution.minimumPushes(**test_input) == 7

test_input = { "word": "pesmonc" }
assert my_solution.minimumPushes(**test_input) == 7

test_input = { "word": "pudymjw" }
assert my_solution.minimumPushes(**test_input) == 7


count-the-number-of-houses-at-a-certain-distance-i

Count the Number of Houses at a Certain Distance I

Prompt:
"""
You are given three positive integers n, x, and y.
In a city, there exist houses numbered 1 to n connected by n streets. There is a street connecting the house numbered i with the house numbered i + 1 for all 1 <= i <= n - 1 . An additional street connects the house numbered x with the house numbered y.
For each k, such that 1 <= k <= n, you need to find the number of pairs of houses (house1, house2) such that the minimum number of streets that need to be traveled to reach house2 from house1 is k.
Return a 1-indexed array result of length n where result[k] represents the total number of pairs of houses such that the minimum streets required to reach one house from the other is k.
Note that x and y can be equal.

Example 1:

Input: n = 3, x = 1, y = 3
Output: [6,0,0]
Explanation: Let's look at each pair of houses:
- For the pair (1, 2), we can go from house 1 to house 2 directly.
- For the pair (2, 1), we can go from house 2 to house 1 directly.
- For the pair (1, 3), we can go from house 1 to house 3 directly.
- For the pair (3, 1), we can go from house 3 to house 1 directly.
- For the pair (2, 3), we can go from house 2 to house 3 directly.
- For the pair (3, 2), we can go from house 3 to house 2 directly.

Example 2:

Input: n = 5, x = 2, y = 4
Output: [10,8,2,0,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (2, 4), (4, 2), (3, 4), (4, 3), (4, 5), and (5, 4).
- For k == 2, the pairs are (1, 3), (3, 1), (1, 4), (4, 1), (2, 5), (5, 2), (3, 5), and (5, 3).
- For k == 3, the pairs are (1, 5), and (5, 1).
- For k == 4 and k == 5, there are no pairs.

Example 3:

Input: n = 4, x = 1, y = 1
Output: [6,4,2,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (3, 4), and (4, 3).
- For k == 2, the pairs are (1, 3), (3, 1), (2, 4), and (4, 2).
- For k == 3, the pairs are (1, 4), and (4, 1).
- For k == 4, there are no pairs.

Constraints:

2 <= n <= 100
1 <= x, y <= n
"""
class Solution:
    def countOfPairs(self, n: int, x: int, y: int) -> List[int]:

You are given three positive integers n, x, and y.
In a city, there exist houses numbered 1 to n connected by n streets. There is a street connecting the house numbered i with the house numbered i + 1 for all 1 <= i <= n - 1 . An additional street connects the house numbered x with the house numbered y.
For each k, such that 1 <= k <= n, you need to find the number of pairs of houses (house1, house2) such that the minimum number of streets that need to be traveled to reach house2 from house1 is k.
Return a 1-indexed array result of length n where result[k] represents the total number of pairs of houses such that the minimum streets required to reach one house from the other is k.
Note that x and y can be equal.

Example 1:

Input: n = 3, x = 1, y = 3
Output: [6,0,0]
Explanation: Let's look at each pair of houses:
- For the pair (1, 2), we can go from house 1 to house 2 directly.
- For the pair (2, 1), we can go from house 2 to house 1 directly.
- For the pair (1, 3), we can go from house 1 to house 3 directly.
- For the pair (3, 1), we can go from house 3 to house 1 directly.
- For the pair (2, 3), we can go from house 2 to house 3 directly.
- For the pair (3, 2), we can go from house 3 to house 2 directly.

Example 2:

Input: n = 5, x = 2, y = 4
Output: [10,8,2,0,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (2, 4), (4, 2), (3, 4), (4, 3), (4, 5), and (5, 4).
- For k == 2, the pairs are (1, 3), (3, 1), (1, 4), (4, 1), (2, 5), (5, 2), (3, 5), and (5, 3).
- For k == 3, the pairs are (1, 5), and (5, 1).
- For k == 4 and k == 5, there are no pairs.

Example 3:

Input: n = 4, x = 1, y = 1
Output: [6,4,2,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (3, 4), and (4, 3).
- For k == 2, the pairs are (1, 3), (3, 1), (2, 4), and (4, 2).
- For k == 3, the pairs are (1, 4), and (4, 1).
- For k == 4, there are no pairs.

Constraints:

2 <= n <= 100
1 <= x, y <= n

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

```

my_solution = Solution()

test_input = { "n": 3, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,0,0]

test_input = { "n": 5, "x": 2, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 4, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 2, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 2, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 2, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 2, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 3, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [4,2,0]

test_input = { "n": 3, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [4,2,0]

test_input = { "n": 3, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [4,2,0]

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

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

test_input = { "n": 3, "x": 3, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [6,0,0]

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

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

test_input = { "n": 4, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 1, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 2, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 2, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 3, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 3, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 3, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 3, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 4, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 4, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 4, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 5, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [10,6,4,0,0]

test_input = { "n": 5, "x": 1, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 5, "x": 1, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,10,0,0,0]

test_input = { "n": 5, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 2, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 2, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 5, "x": 3, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [10,6,4,0,0]

test_input = { "n": 5, "x": 3, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 3, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 3, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 3, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,6,4,0,0]

test_input = { "n": 5, "x": 4, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 5, "x": 4, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 5, "x": 4, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 4, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 5, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [10,10,0,0,0]

test_input = { "n": 5, "x": 5, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 5, "x": 5, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [10,6,4,0,0]

test_input = { "n": 5, "x": 5, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 5, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 6, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [12,8,6,4,0,0]

test_input = { "n": 6, "x": 1, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 1, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [12,14,4,0,0,0]

test_input = { "n": 6, "x": 1, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [12,12,6,0,0,0]

test_input = { "n": 6, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 2, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [12,12,6,0,0,0]

test_input = { "n": 6, "x": 2, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [12,14,4,0,0,0]

test_input = { "n": 6, "x": 3, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [12,8,6,4,0,0]

test_input = { "n": 6, "x": 3, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 3, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 3, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 3, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 3, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 4, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 4, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 4, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 4, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [12,8,6,4,0,0]

test_input = { "n": 6, "x": 5, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [12,14,4,0,0,0]

test_input = { "n": 6, "x": 5, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,12,6,0,0,0]

test_input = { "n": 6, "x": 5, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 5, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 5, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 5, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 6, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [12,12,6,0,0,0]

test_input = { "n": 6, "x": 6, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,14,4,0,0,0]

test_input = { "n": 6, "x": 6, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 6, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [12,8,6,4,0,0]

test_input = { "n": 6, "x": 6, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 6, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 7, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [14,10,8,6,4,0,0]

test_input = { "n": 7, "x": 1, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [14,12,8,6,2,0,0]

test_input = { "n": 7, "x": 1, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [14,16,8,4,0,0,0]

test_input = { "n": 7, "x": 1, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [14,16,10,2,0,0,0]

test_input = { "n": 7, "x": 1, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [14,14,14,0,0,0,0]

test_input = { "n": 7, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 2, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 2, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [14,16,10,2,0,0,0]

test_input = { "n": 7, "x": 3, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [14,10,8,6,4,0,0]

test_input = { "n": 7, "x": 3, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 3, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]


minimum-number-of-pushes-to-type-word-ii

Minimum Number of Pushes to Type Word II

Prompt:
"""
You are given a string word containing lowercase English letters.
Telephone keypads have keys mapped with distinct collections of lowercase English letters, which can be used to form words by pushing them. For example, the key 2 is mapped with ["a","b","c"], we need to push the key one time to type "a", two times to type "b", and three times to type "c" .
It is allowed to remap the keys numbered 2 to 9 to distinct collections of letters. The keys can be remapped to any amount of letters, but each letter must be mapped to exactly one key. You need to find the minimum number of times the keys will be pushed to type the string word.
Return the minimum number of pushes needed to type word after remapping the keys.
An example mapping of letters to keys on a telephone keypad is given below. Note that 1, *, #, and 0 do not map to any letters.

Example 1:

Input: word = "abcde"
Output: 5
Explanation: The remapped keypad given in the image provides the minimum cost.
"a" -> one push on key 2
"b" -> one push on key 3
"c" -> one push on key 4
"d" -> one push on key 5
"e" -> one push on key 6
Total cost is 1 + 1 + 1 + 1 + 1 = 5.
It can be shown that no other mapping can provide a lower cost.

Example 2:

Input: word = "xyzxyzxyzxyz"
Output: 12
Explanation: The remapped keypad given in the image provides the minimum cost.
"x" -> one push on key 2
"y" -> one push on key 3
"z" -> one push on key 4
Total cost is 1 * 4 + 1 * 4 + 1 * 4 = 12
It can be shown that no other mapping can provide a lower cost.
Note that the key 9 is not mapped to any letter: it is not necessary to map letters to every key, but to map all the letters.

Example 3:

Input: word = "aabbccddeeffgghhiiiiii"
Output: 24
Explanation: The remapped keypad given in the image provides the minimum cost.
"a" -> one push on key 2
"b" -> one push on key 3
"c" -> one push on key 4
"d" -> one push on key 5
"e" -> one push on key 6
"f" -> one push on key 7
"g" -> one push on key 8
"h" -> two pushes on key 9
"i" -> one push on key 9
Total cost is 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 2 * 2 + 6 * 1 = 24.
It can be shown that no other mapping can provide a lower cost.

Constraints:

1 <= word.length <= 105
word consists of lowercase English letters.
"""
class Solution:
    def minimumPushes(self, word: str) -> int:

You are given a string word containing lowercase English letters.
Telephone keypads have keys mapped with distinct collections of lowercase English letters, which can be used to form words by pushing them. For example, the key 2 is mapped with ["a","b","c"], we need to push the key one time to type "a", two times to type "b", and three times to type "c" .
It is allowed to remap the keys numbered 2 to 9 to distinct collections of letters. The keys can be remapped to any amount of letters, but each letter must be mapped to exactly one key. You need to find the minimum number of times the keys will be pushed to type the string word.
Return the minimum number of pushes needed to type word after remapping the keys.
An example mapping of letters to keys on a telephone keypad is given below. Note that 1, *, #, and 0 do not map to any letters.

Example 1:

Input: word = "abcde"
Output: 5
Explanation: The remapped keypad given in the image provides the minimum cost.
"a" -> one push on key 2
"b" -> one push on key 3
"c" -> one push on key 4
"d" -> one push on key 5
"e" -> one push on key 6
Total cost is 1 + 1 + 1 + 1 + 1 = 5.
It can be shown that no other mapping can provide a lower cost.

Example 2:

Input: word = "xyzxyzxyzxyz"
Output: 12
Explanation: The remapped keypad given in the image provides the minimum cost.
"x" -> one push on key 2
"y" -> one push on key 3
"z" -> one push on key 4
Total cost is 1 * 4 + 1 * 4 + 1 * 4 = 12
It can be shown that no other mapping can provide a lower cost.
Note that the key 9 is not mapped to any letter: it is not necessary to map letters to every key, but to map all the letters.

Example 3:

Input: word = "aabbccddeeffgghhiiiiii"
Output: 24
Explanation: The remapped keypad given in the image provides the minimum cost.
"a" -> one push on key 2
"b" -> one push on key 3
"c" -> one push on key 4
"d" -> one push on key 5
"e" -> one push on key 6
"f" -> one push on key 7
"g" -> one push on key 8
"h" -> two pushes on key 9
"i" -> one push on key 9
Total cost is 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 1 * 2 + 2 * 2 + 6 * 1 = 24.
It can be shown that no other mapping can provide a lower cost.

Constraints:

1 <= word.length <= 105
word consists of lowercase English letters.

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

```

my_solution = Solution()

test_input = { "word": "abcde" }
assert my_solution.minimumPushes(**test_input) == 5

test_input = { "word": "xyzxyzxyzxyz" }
assert my_solution.minimumPushes(**test_input) == 12

test_input = { "word": "aabbccddeeffgghhiiiiii" }
assert my_solution.minimumPushes(**test_input) == 24

test_input = { "word": "a" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "f" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "h" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "i" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "l" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "o" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "q" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "s" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "t" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "u" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "x" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "y" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "z" }
assert my_solution.minimumPushes(**test_input) == 1

test_input = { "word": "at" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "aw" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "bd" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "bs" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "ck" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "de" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "ex" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "fy" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "fz" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "hu" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "ir" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "iz" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "km" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "lr" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "lu" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "mz" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "ng" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "nu" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "oo" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "qc" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "rv" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "se" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "up" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "wb" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "xg" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "yg" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "zv" }
assert my_solution.minimumPushes(**test_input) == 2

test_input = { "word": "abx" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "amw" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "bem" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "bhs" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "blg" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "bwq" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "cku" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "cmo" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "cnr" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "dgh" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "dmh" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "dqf" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "eys" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "fff" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "foz" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "fqw" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "fsh" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "gjz" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "gpx" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "gqu" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "jcc" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "nmu" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "pzm" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "rdz" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "rvy" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "rya" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "sbn" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "szd" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "tbd" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "uqk" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "vbh" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "vgr" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "vxy" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "xbp" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "yex" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "ynx" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "yuv" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "zih" }
assert my_solution.minimumPushes(**test_input) == 3

test_input = { "word": "acpy" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "ainw" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "aluw" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "ayfb" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "bbmr" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "bgta" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "bitn" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "bwif" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "bwrz" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "cdcl" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "dglo" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "dxng" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "earx" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "feig" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "fgjk" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "flmd" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "fnfp" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "glms" }
assert my_solution.minimumPushes(**test_input) == 4

test_input = { "word": "glou" }
assert my_solution.minimumPushes(**test_input) == 4


count-the-number-of-houses-at-a-certain-distance-ii

Count the Number of Houses at a Certain Distance II

Prompt:
"""
You are given three positive integers n, x, and y.
In a city, there exist houses numbered 1 to n connected by n streets. There is a street connecting the house numbered i with the house numbered i + 1 for all 1 <= i <= n - 1 . An additional street connects the house numbered x with the house numbered y.
For each k, such that 1 <= k <= n, you need to find the number of pairs of houses (house1, house2) such that the minimum number of streets that need to be traveled to reach house2 from house1 is k.
Return a 1-indexed array result of length n where result[k] represents the total number of pairs of houses such that the minimum streets required to reach one house from the other is k.
Note that x and y can be equal.

Example 1:

Input: n = 3, x = 1, y = 3
Output: [6,0,0]
Explanation: Let's look at each pair of houses:
- For the pair (1, 2), we can go from house 1 to house 2 directly.
- For the pair (2, 1), we can go from house 2 to house 1 directly.
- For the pair (1, 3), we can go from house 1 to house 3 directly.
- For the pair (3, 1), we can go from house 3 to house 1 directly.
- For the pair (2, 3), we can go from house 2 to house 3 directly.
- For the pair (3, 2), we can go from house 3 to house 2 directly.

Example 2:

Input: n = 5, x = 2, y = 4
Output: [10,8,2,0,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (2, 4), (4, 2), (3, 4), (4, 3), (4, 5), and (5, 4).
- For k == 2, the pairs are (1, 3), (3, 1), (1, 4), (4, 1), (2, 5), (5, 2), (3, 5), and (5, 3).
- For k == 3, the pairs are (1, 5), and (5, 1).
- For k == 4 and k == 5, there are no pairs.

Example 3:

Input: n = 4, x = 1, y = 1
Output: [6,4,2,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (3, 4), and (4, 3).
- For k == 2, the pairs are (1, 3), (3, 1), (2, 4), and (4, 2).
- For k == 3, the pairs are (1, 4), and (4, 1).
- For k == 4, there are no pairs.

Constraints:

2 <= n <= 105
1 <= x, y <= n
"""
class Solution:
    def countOfPairs(self, n: int, x: int, y: int) -> List[int]:

You are given three positive integers n, x, and y.
In a city, there exist houses numbered 1 to n connected by n streets. There is a street connecting the house numbered i with the house numbered i + 1 for all 1 <= i <= n - 1 . An additional street connects the house numbered x with the house numbered y.
For each k, such that 1 <= k <= n, you need to find the number of pairs of houses (house1, house2) such that the minimum number of streets that need to be traveled to reach house2 from house1 is k.
Return a 1-indexed array result of length n where result[k] represents the total number of pairs of houses such that the minimum streets required to reach one house from the other is k.
Note that x and y can be equal.

Example 1:

Input: n = 3, x = 1, y = 3
Output: [6,0,0]
Explanation: Let's look at each pair of houses:
- For the pair (1, 2), we can go from house 1 to house 2 directly.
- For the pair (2, 1), we can go from house 2 to house 1 directly.
- For the pair (1, 3), we can go from house 1 to house 3 directly.
- For the pair (3, 1), we can go from house 3 to house 1 directly.
- For the pair (2, 3), we can go from house 2 to house 3 directly.
- For the pair (3, 2), we can go from house 3 to house 2 directly.

Example 2:

Input: n = 5, x = 2, y = 4
Output: [10,8,2,0,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (2, 4), (4, 2), (3, 4), (4, 3), (4, 5), and (5, 4).
- For k == 2, the pairs are (1, 3), (3, 1), (1, 4), (4, 1), (2, 5), (5, 2), (3, 5), and (5, 3).
- For k == 3, the pairs are (1, 5), and (5, 1).
- For k == 4 and k == 5, there are no pairs.

Example 3:

Input: n = 4, x = 1, y = 1
Output: [6,4,2,0]
Explanation: For each distance k the pairs are:
- For k == 1, the pairs are (1, 2), (2, 1), (2, 3), (3, 2), (3, 4), and (4, 3).
- For k == 2, the pairs are (1, 3), (3, 1), (2, 4), and (4, 2).
- For k == 3, the pairs are (1, 4), and (4, 1).
- For k == 4, there are no pairs.

Constraints:

2 <= n <= 105
1 <= x, y <= n

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

```

my_solution = Solution()

test_input = { "n": 3, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,0,0]

test_input = { "n": 5, "x": 2, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 4, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 2, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 2, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 2, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 2, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [2,0]

test_input = { "n": 3, "x": 1, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [4,2,0]

test_input = { "n": 3, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [4,2,0]

test_input = { "n": 3, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [4,2,0]

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

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

test_input = { "n": 3, "x": 3, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [6,0,0]

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

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

test_input = { "n": 4, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 1, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 2, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 2, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 2, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 3, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 3, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 3, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 3, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 4, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 4, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [8,4,0,0]

test_input = { "n": 4, "x": 4, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 4, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [6,4,2,0]

test_input = { "n": 5, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [10,6,4,0,0]

test_input = { "n": 5, "x": 2, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 2, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 5, "x": 3, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,6,4,0,0]

test_input = { "n": 5, "x": 4, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [10,8,2,0,0]

test_input = { "n": 5, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 5, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [10,6,4,0,0]

test_input = { "n": 5, "x": 5, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 5, "x": 5, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [8,6,4,2,0]

test_input = { "n": 6, "x": 1, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 1, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [12,14,4,0,0,0]

test_input = { "n": 6, "x": 1, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [12,12,6,0,0,0]

test_input = { "n": 6, "x": 3, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 3, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [12,10,6,2,0,0]

test_input = { "n": 6, "x": 4, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 4, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 4, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [12,8,6,4,0,0]

test_input = { "n": 6, "x": 5, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,12,6,0,0,0]

test_input = { "n": 6, "x": 5, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 6, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,14,4,0,0,0]

test_input = { "n": 6, "x": 6, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [12,8,6,4,0,0]

test_input = { "n": 6, "x": 6, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 6, "x": 6, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [10,8,6,4,2,0]

test_input = { "n": 7, "x": 1, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [14,14,14,0,0,0,0]

test_input = { "n": 7, "x": 2, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [14,18,10,0,0,0,0]

test_input = { "n": 7, "x": 3, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 3, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 3, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [14,14,10,4,0,0,0]

test_input = { "n": 7, "x": 4, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 4, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [14,12,8,6,2,0,0]

test_input = { "n": 7, "x": 5, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,4,2,0,0]

test_input = { "n": 7, "x": 5, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 5, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [14,10,8,6,4,0,0]

test_input = { "n": 7, "x": 6, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 6, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [12,10,8,6,4,2,0]

test_input = { "n": 7, "x": 7, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [14,12,8,6,2,0,0]

test_input = { "n": 8, "x": 1, "y": 2 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,8,6,4,2,0]

test_input = { "n": 8, "x": 2, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [16,20,16,4,0,0,0,0]

test_input = { "n": 8, "x": 3, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,8,4,2,0,0]

test_input = { "n": 8, "x": 3, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [16,16,14,8,2,0,0,0]

test_input = { "n": 8, "x": 4, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,8,6,4,2,0]

test_input = { "n": 8, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,8,6,4,2,0]

test_input = { "n": 8, "x": 4, "y": 8 }
assert my_solution.countOfPairs(**test_input) == [16,18,10,8,4,0,0,0]

test_input = { "n": 8, "x": 5, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,8,4,2,0,0]

test_input = { "n": 8, "x": 5, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [16,14,10,8,6,2,0,0]

test_input = { "n": 8, "x": 6, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [16,16,14,8,2,0,0,0]

test_input = { "n": 8, "x": 6, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,8,6,4,2,0]

test_input = { "n": 8, "x": 6, "y": 8 }
assert my_solution.countOfPairs(**test_input) == [16,12,10,8,6,4,0,0]

test_input = { "n": 8, "x": 7, "y": 8 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,8,6,4,2,0]

test_input = { "n": 8, "x": 8, "y": 1 }
assert my_solution.countOfPairs(**test_input) == [16,16,16,8,0,0,0,0]

test_input = { "n": 8, "x": 8, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,8,6,4,2,0]

test_input = { "n": 8, "x": 8, "y": 8 }
assert my_solution.countOfPairs(**test_input) == [14,12,10,8,6,4,2,0]

test_input = { "n": 9, "x": 1, "y": 3 }
assert my_solution.countOfPairs(**test_input) == [18,14,12,10,8,6,4,0,0]

test_input = { "n": 9, "x": 4, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,10,8,6,4,2,0]

test_input = { "n": 9, "x": 4, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [18,16,14,12,6,4,2,0,0]

test_input = { "n": 9, "x": 4, "y": 9 }
assert my_solution.countOfPairs(**test_input) == [18,20,16,10,6,2,0,0,0]

test_input = { "n": 9, "x": 5, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,10,8,6,4,2,0]

test_input = { "n": 9, "x": 5, "y": 9 }
assert my_solution.countOfPairs(**test_input) == [18,20,12,10,8,4,0,0,0]

test_input = { "n": 9, "x": 6, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,10,8,6,4,2,0]

test_input = { "n": 9, "x": 7, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,10,8,6,4,2,0]

test_input = { "n": 9, "x": 8, "y": 4 }
assert my_solution.countOfPairs(**test_input) == [18,22,16,10,6,0,0,0,0]

test_input = { "n": 9, "x": 8, "y": 6 }
assert my_solution.countOfPairs(**test_input) == [18,16,12,10,8,6,2,0,0]

test_input = { "n": 9, "x": 8, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,10,8,6,4,2,0]

test_input = { "n": 9, "x": 8, "y": 9 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,10,8,6,4,2,0]

test_input = { "n": 9, "x": 9, "y": 5 }
assert my_solution.countOfPairs(**test_input) == [18,20,12,10,8,4,0,0,0]

test_input = { "n": 9, "x": 9, "y": 7 }
assert my_solution.countOfPairs(**test_input) == [18,14,12,10,8,6,4,0,0]

test_input = { "n": 9, "x": 9, "y": 8 }
assert my_solution.countOfPairs(**test_input) == [16,14,12,10,8,6,4,2,0]


divide-an-array-into-subarrays-with-minimum-cost-i

Divide an Array Into Subarrays With Minimum Cost I

Prompt:
"""
You are given an array of integers nums of length n.
The cost of an array is the value of its first element. For example, the cost of [1,2,3] is 1 while the cost of [3,4,1] is 3.
You need to divide nums into 3 disjoint contiguous subarrays.
Return the minimum possible sum of the cost of these subarrays.

Example 1:

Input: nums = [1,2,3,12]
Output: 6
Explanation: The best possible way to form 3 subarrays is: [1], [2], and [3,12] at a total cost of 1 + 2 + 3 = 6.
The other possible ways to form 3 subarrays are:
- [1], [2,3], and [12] at a total cost of 1 + 2 + 12 = 15.
- [1,2], [3], and [12] at a total cost of 1 + 3 + 12 = 16.

Example 2:

Input: nums = [5,4,3]
Output: 12
Explanation: The best possible way to form 3 subarrays is: [5], [4], and [3] at a total cost of 5 + 4 + 3 = 12.
It can be shown that 12 is the minimum cost achievable.

Example 3:

Input: nums = [10,3,1,1]
Output: 12
Explanation: The best possible way to form 3 subarrays is: [10,3], [1], and [1] at a total cost of 10 + 1 + 1 = 12.
It can be shown that 12 is the minimum cost achievable.

Constraints:

3 <= n <= 50
1 <= nums[i] <= 50
"""
class Solution:
    def minimumCost(self, nums: List[int]) -> int:

You are given an array of integers nums of length n.
The cost of an array is the value of its first element. For example, the cost of [1,2,3] is 1 while the cost of [3,4,1] is 3.
You need to divide nums into 3 disjoint contiguous subarrays.
Return the minimum possible sum of the cost of these subarrays.

Example 1:

Input: nums = [1,2,3,12]
Output: 6
Explanation: The best possible way to form 3 subarrays is: [1], [2], and [3,12] at a total cost of 1 + 2 + 3 = 6.
The other possible ways to form 3 subarrays are:
- [1], [2,3], and [12] at a total cost of 1 + 2 + 12 = 15.
- [1,2], [3], and [12] at a total cost of 1 + 3 + 12 = 16.

Example 2:

Input: nums = [5,4,3]
Output: 12
Explanation: The best possible way to form 3 subarrays is: [5], [4], and [3] at a total cost of 5 + 4 + 3 = 12.
It can be shown that 12 is the minimum cost achievable.

Example 3:

Input: nums = [10,3,1,1]
Output: 12
Explanation: The best possible way to form 3 subarrays is: [10,3], [1], and [1] at a total cost of 10 + 1 + 1 = 12.
It can be shown that 12 is the minimum cost achievable.

Constraints:

3 <= n <= 50
1 <= nums[i] <= 50

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


find-if-array-can-be-sorted

Find if Array Can Be Sorted

Prompt:
"""
You are given a 0-indexed array of positive integers nums.
In one operation, you can swap any two adjacent elements if they have the same number of set bits. You are allowed to do this operation any number of times (including zero).
Return true if you can sort the array, else return false.

Example 1:

Input: nums = [8,4,2,30,15]
Output: true
Explanation: Let's look at the binary representation of every element. The numbers 2, 4, and 8 have one set bit each with binary representation "10", "100", and "1000" respectively. The numbers 15 and 30 have four set bits each with binary representation "1111" and "11110".
We can sort the array using 4 operations:
- Swap nums[0] with nums[1]. This operation is valid because 8 and 4 have one set bit each. The array becomes [4,8,2,30,15].
- Swap nums[1] with nums[2]. This operation is valid because 8 and 2 have one set bit each. The array becomes [4,2,8,30,15].
- Swap nums[0] with nums[1]. This operation is valid because 4 and 2 have one set bit each. The array becomes [2,4,8,30,15].
- Swap nums[3] with nums[4]. This operation is valid because 30 and 15 have four set bits each. The array becomes [2,4,8,15,30].
The array has become sorted, hence we return true.
Note that there may be other sequences of operations which also sort the array.

Example 2:

Input: nums = [1,2,3,4,5]
Output: true
Explanation: The array is already sorted, hence we return true.

Example 3:

Input: nums = [3,16,8,4,2]
Output: false
Explanation: It can be shown that it is not possible to sort the input array using any number of operations.

Constraints:

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

You are given a 0-indexed array of positive integers nums.
In one operation, you can swap any two adjacent elements if they have the same number of set bits. You are allowed to do this operation any number of times (including zero).
Return true if you can sort the array, else return false.

Example 1:

Input: nums = [8,4,2,30,15]
Output: true
Explanation: Let's look at the binary representation of every element. The numbers 2, 4, and 8 have one set bit each with binary representation "10", "100", and "1000" respectively. The numbers 15 and 30 have four set bits each with binary representation "1111" and "11110".
We can sort the array using 4 operations:
- Swap nums[0] with nums[1]. This operation is valid because 8 and 4 have one set bit each. The array becomes [4,8,2,30,15].
- Swap nums[1] with nums[2]. This operation is valid because 8 and 2 have one set bit each. The array becomes [4,2,8,30,15].
- Swap nums[0] with nums[1]. This operation is valid because 4 and 2 have one set bit each. The array becomes [2,4,8,30,15].
- Swap nums[3] with nums[4]. This operation is valid because 30 and 15 have four set bits each. The array becomes [2,4,8,15,30].
The array has become sorted, hence we return true.
Note that there may be other sequences of operations which also sort the array.

Example 2:

Input: nums = [1,2,3,4,5]
Output: true
Explanation: The array is already sorted, hence we return true.

Example 3:

Input: nums = [3,16,8,4,2]
Output: false
Explanation: It can be shown that it is not possible to sort the input array using any number of operations.

Constraints:

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

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

```

my_solution = Solution()

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

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

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

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

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

test_input = { "nums": [7] }
assert my_solution.canSortArray(**test_input) == True

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

test_input = { "nums": [20,16] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [18] }
assert my_solution.canSortArray(**test_input) == True

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

test_input = { "nums": [30] }
assert my_solution.canSortArray(**test_input) == True

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

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

test_input = { "nums": [2,28,9] }
assert my_solution.canSortArray(**test_input) == False

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

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

test_input = { "nums": [31,18,23] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [75,34,30] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [107,76,52] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [125,92,159] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [136,256,10] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [160,247,127] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [187,4,32] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [197,171,144] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [214,200,176] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [222,191,39] }
assert my_solution.canSortArray(**test_input) == False

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

test_input = { "nums": [225,163,64] }
assert my_solution.canSortArray(**test_input) == False

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

test_input = { "nums": [229,253,127] }
assert my_solution.canSortArray(**test_input) == False

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

test_input = { "nums": [1,256,64] }
assert my_solution.canSortArray(**test_input) == True

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

test_input = { "nums": [239,83,71] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [6,96,20] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [247,153,90] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [256,255,255] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [1,201,251,191] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [4,157,191,127] }
assert my_solution.canSortArray(**test_input) == False

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

test_input = { "nums": [10,34,130] }
assert my_solution.canSortArray(**test_input) == True

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

test_input = { "nums": [10,91,127] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [15,8,21,25] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [17,25,4,27] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [10,130,206] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [14,183,251] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [29,20,17,4] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [15,147,174] }
assert my_solution.canSortArray(**test_input) == True

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

test_input = { "nums": [32,12,25,19] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [22,21,26] }
assert my_solution.canSortArray(**test_input) == True

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

test_input = { "nums": [24,72,160] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [33,223,239] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [35,143,127,254] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [55,147,16,8] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [34,52,104] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [100,104,96,144] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [129,70,126,253] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [129,162,158,253] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [145,127,55,43] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [36,177,244] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [159,111,124,233] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [36,213,236] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [175,231,27,92] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [205,234,127,223] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [215,10,8,256] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [223,127,172,210] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [38,221,224] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [41,14,50] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [41,79,239] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [44,124,247] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [225,201,121,103] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [232,45,175,231] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [250,131,50,46] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [254,249,173,163] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [255,255,214,229] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [256,151,141,15] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [47,205,182] }
assert my_solution.canSortArray(**test_input) == True

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

test_input = { "nums": [51,253,254] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [53,172,195] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [57,127,251] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [4,98,210,79,254] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [59,31,236] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [8,5,103,247,235] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [8,74,170,254,132] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [8,148,182,62,255] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [62,153,210] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [64,93,253] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [9,28,18,26,11] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [12,208,240,216,139] }
assert my_solution.canSortArray(**test_input) == False

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

test_input = { "nums": [16,24,13,46,156] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [16,192,71,31,239] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [64,195,203] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [65,254,239] }
assert my_solution.canSortArray(**test_input) == True

test_input = { "nums": [17,11,5,20,8] }
assert my_solution.canSortArray(**test_input) == False

test_input = { "nums": [23,12,22,29,20] }
assert my_solution.canSortArray(**test_input) == False


minimize-length-of-array-using-operations

Minimize Length of Array Using Operations

Prompt:
"""
You are given a 0-indexed integer array nums containing positive integers.
Your task is to minimize the length of nums by performing the following operations any number of times (including zero):

Select two distinct indices i and j from nums, such that nums[i] > 0 and nums[j] > 0.
Insert the result of nums[i] % nums[j] at the end of nums.
Delete the elements at indices i and j from nums.

Return an integer denoting the minimum length of nums after performing the operation any number of times.

Example 1:

Input: nums = [1,4,3,1]
Output: 1
Explanation: One way to minimize the length of the array is as follows:
Operation 1: Select indices 2 and 1, insert nums[2] % nums[1] at the end and it becomes [1,4,3,1,3], then delete elements at indices 2 and 1.
nums becomes [1,1,3].
Operation 2: Select indices 1 and 2, insert nums[1] % nums[2] at the end and it becomes [1,1,3,1], then delete elements at indices 1 and 2.
nums becomes [1,1].
Operation 3: Select indices 1 and 0, insert nums[1] % nums[0] at the end and it becomes [1,1,0], then delete elements at indices 1 and 0.
nums becomes [0].
The length of nums cannot be reduced further. Hence, the answer is 1.
It can be shown that 1 is the minimum achievable length.
Example 2:

Input: nums = [5,5,5,10,5]
Output: 2
Explanation: One way to minimize the length of the array is as follows:
Operation 1: Select indices 0 and 3, insert nums[0] % nums[3] at the end and it becomes [5,5,5,10,5,5], then delete elements at indices 0 and 3.
nums becomes [5,5,5,5].
Operation 2: Select indices 2 and 3, insert nums[2] % nums[3] at the end and it becomes [5,5,5,5,0], then delete elements at indices 2 and 3.
nums becomes [5,5,0].
Operation 3: Select indices 0 and 1, insert nums[0] % nums[1] at the end and it becomes [5,5,0,0], then delete elements at indices 0 and 1.
nums becomes [0,0].
The length of nums cannot be reduced further. Hence, the answer is 2.
It can be shown that 2 is the minimum achievable length.
Example 3:

Input: nums = [2,3,4]
Output: 1
Explanation: One way to minimize the length of the array is as follows:
Operation 1: Select indices 1 and 2, insert nums[1] % nums[2] at the end and it becomes [2,3,4,3], then delete elements at indices 1 and 2.
nums becomes [2,3].
Operation 2: Select indices 1 and 0, insert nums[1] % nums[0] at the end and it becomes [2,3,1], then delete elements at indices 1 and 0.
nums becomes [1].
The length of nums cannot be reduced further. Hence, the answer is 1.
It can be shown that 1 is the minimum achievable length.

Constraints:

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

You are given a 0-indexed integer array nums containing positive integers.
Your task is to minimize the length of nums by performing the following operations any number of times (including zero):

Select two distinct indices i and j from nums, such that nums[i] > 0 and nums[j] > 0.
Insert the result of nums[i] % nums[j] at the end of nums.
Delete the elements at indices i and j from nums.

Return an integer denoting the minimum length of nums after performing the operation any number of times.

Example 1:

Input: nums = [1,4,3,1]
Output: 1
Explanation: One way to minimize the length of the array is as follows:
Operation 1: Select indices 2 and 1, insert nums[2] % nums[1] at the end and it becomes [1,4,3,1,3], then delete elements at indices 2 and 1.
nums becomes [1,1,3].
Operation 2: Select indices 1 and 2, insert nums[1] % nums[2] at the end and it becomes [1,1,3,1], then delete elements at indices 1 and 2.
nums becomes [1,1].
Operation 3: Select indices 1 and 0, insert nums[1] % nums[0] at the end and it becomes [1,1,0], then delete elements at indices 1 and 0.
nums becomes [0].
The length of nums cannot be reduced further. Hence, the answer is 1.
It can be shown that 1 is the minimum achievable length.
Example 2:

Input: nums = [5,5,5,10,5]
Output: 2
Explanation: One way to minimize the length of the array is as follows:
Operation 1: Select indices 0 and 3, insert nums[0] % nums[3] at the end and it becomes [5,5,5,10,5,5], then delete elements at indices 0 and 3.
nums becomes [5,5,5,5].
Operation 2: Select indices 2 and 3, insert nums[2] % nums[3] at the end and it becomes [5,5,5,5,0], then delete elements at indices 2 and 3.
nums becomes [5,5,0].
Operation 3: Select indices 0 and 1, insert nums[0] % nums[1] at the end and it becomes [5,5,0,0], then delete elements at indices 0 and 1.
nums becomes [0,0].
The length of nums cannot be reduced further. Hence, the answer is 2.
It can be shown that 2 is the minimum achievable length.
Example 3:

Input: nums = [2,3,4]
Output: 1
Explanation: One way to minimize the length of the array is as follows:
Operation 1: Select indices 1 and 2, insert nums[1] % nums[2] at the end and it becomes [2,3,4,3], then delete elements at indices 1 and 2.
nums becomes [2,3].
Operation 2: Select indices 1 and 0, insert nums[1] % nums[0] at the end and it becomes [2,3,1], then delete elements at indices 1 and 0.
nums becomes [1].
The length of nums cannot be reduced further. Hence, the answer is 1.
It can be shown that 1 is the minimum achievable length.

Constraints:

1 <= nums.length <= 105
1 <= nums[i] <= 109

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [5,2,2,2,9,10] }
assert my_solution.minimumArrayLength(**test_input) == 1

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

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

test_input = { "nums": [8,3,9,4,5,8] }
assert my_solution.minimumArrayLength(**test_input) == 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [8,5,4,5,4,7,6,10] }
assert my_solution.minimumArrayLength(**test_input) == 1

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

test_input = { "nums": [2,6,3,8,9,10,9,3,10] }
assert my_solution.minimumArrayLength(**test_input) == 1

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

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

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

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

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

test_input = { "nums": [6,4,5,7,9,10,10,6,9] }
assert my_solution.minimumArrayLength(**test_input) == 1

test_input = { "nums": [6,5,6,4,9,8,8,3,7] }
assert my_solution.minimumArrayLength(**test_input) == 1

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

test_input = { "nums": [9,10,1,6,4,10,1,3,4] }
assert my_solution.minimumArrayLength(**test_input) == 1

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

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

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

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

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

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

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

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

test_input = { "nums": [5,9,3,9,3,10,1,1,6,3,10] }
assert my_solution.minimumArrayLength(**test_input) == 1