length-of-longest-subarray-with-at-most-k-frequency

Length of Longest Subarray With at Most K Frequency

Prompt:
"""
You are given an integer array nums and an integer k.
The frequency of an element x is the number of times it occurs in an array.
An array is called good if the frequency of each element in this array is less than or equal to k.
Return the length of the longest good subarray of nums.
A subarray is a contiguous non-empty sequence of elements within an array.

Example 1:

Input: nums = [1,2,3,1,2,3,1,2], k = 2
Output: 6
Explanation: The longest possible good subarray is [1,2,3,1,2,3] since the values 1, 2, and 3 occur at most twice in this subarray. Note that the subarrays [2,3,1,2,3,1] and [3,1,2,3,1,2] are also good.
It can be shown that there are no good subarrays with length more than 6.

Example 2:

Input: nums = [1,2,1,2,1,2,1,2], k = 1
Output: 2
Explanation: The longest possible good subarray is [1,2] since the values 1 and 2 occur at most once in this subarray. Note that the subarray [2,1] is also good.
It can be shown that there are no good subarrays with length more than 2.

Example 3:

Input: nums = [5,5,5,5,5,5,5], k = 4
Output: 4
Explanation: The longest possible good subarray is [5,5,5,5] since the value 5 occurs 4 times in this subarray.
It can be shown that there are no good subarrays with length more than 4.

Constraints:

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

You are given an integer array nums and an integer k.
The frequency of an element x is the number of times it occurs in an array.
An array is called good if the frequency of each element in this array is less than or equal to k.
Return the length of the longest good subarray of nums.
A subarray is a contiguous non-empty sequence of elements within an array.

Example 1:

Input: nums = [1,2,3,1,2,3,1,2], k = 2
Output: 6
Explanation: The longest possible good subarray is [1,2,3,1,2,3] since the values 1, 2, and 3 occur at most twice in this subarray. Note that the subarrays [2,3,1,2,3,1] and [3,1,2,3,1,2] are also good.
It can be shown that there are no good subarrays with length more than 6.

Example 2:

Input: nums = [1,2,1,2,1,2,1,2], k = 1
Output: 2
Explanation: The longest possible good subarray is [1,2] since the values 1 and 2 occur at most once in this subarray. Note that the subarray [2,1] is also good.
It can be shown that there are no good subarrays with length more than 2.

Example 3:

Input: nums = [5,5,5,5,5,5,5], k = 4
Output: 4
Explanation: The longest possible good subarray is [5,5,5,5] since the value 5 occurs 4 times in this subarray.
It can be shown that there are no good subarrays with length more than 4.

Constraints:

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

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [7,9], "k": 2 }
assert my_solution.maxSubarrayLength(**test_input) == 2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [3,6,4], "k": 2 }
assert my_solution.maxSubarrayLength(**test_input) == 3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


number-of-possible-sets-of-closing-branches

Number of Possible Sets of Closing Branches

Prompt:
"""
There is a company with n branches across the country, some of which are connected by roads. Initially, all branches are reachable from each other by traveling some roads.
The company has realized that they are spending an excessive amount of time traveling between their branches. As a result, they have decided to close down some of these branches (possibly none). However, they want to ensure that the remaining branches have a distance of at most maxDistance from each other.
The distance between two branches is the minimum total traveled length needed to reach one branch from another.
You are given integers n, maxDistance, and a 0-indexed 2D array roads, where roads[i] = [ui, vi, wi] represents the undirected road between branches ui and vi with length wi.
Return the number of possible sets of closing branches, so that any branch has a distance of at most maxDistance from any other.
Note that, after closing a branch, the company will no longer have access to any roads connected to it.
Note that, multiple roads are allowed.

Example 1:

Input: n = 3, maxDistance = 5, roads = [[0,1,2],[1,2,10],[0,2,10]]
Output: 5
Explanation: The possible sets of closing branches are:
- The set [2], after closing, active branches are [0,1] and they are reachable to each other within distance 2.
- The set [0,1], after closing, the active branch is [2].
- The set [1,2], after closing, the active branch is [0].
- The set [0,2], after closing, the active branch is [1].
- The set [0,1,2], after closing, there are no active branches.
It can be proven, that there are only 5 possible sets of closing branches.

Example 2:

Input: n = 3, maxDistance = 5, roads = [[0,1,20],[0,1,10],[1,2,2],[0,2,2]]
Output: 7
Explanation: The possible sets of closing branches are:
- The set [], after closing, active branches are [0,1,2] and they are reachable to each other within distance 4.
- The set [0], after closing, active branches are [1,2] and they are reachable to each other within distance 2.
- The set [1], after closing, active branches are [0,2] and they are reachable to each other within distance 2.
- The set [0,1], after closing, the active branch is [2].
- The set [1,2], after closing, the active branch is [0].
- The set [0,2], after closing, the active branch is [1].
- The set [0,1,2], after closing, there are no active branches.
It can be proven, that there are only 7 possible sets of closing branches.

Example 3:

Input: n = 1, maxDistance = 10, roads = []
Output: 2
Explanation: The possible sets of closing branches are:
- The set [], after closing, the active branch is [0].
- The set [0], after closing, there are no active branches.
It can be proven, that there are only 2 possible sets of closing branches.

Constraints:

1 <= n <= 10
1 <= maxDistance <= 105
0 <= roads.length <= 1000
roads[i].length == 3
0 <= ui, vi <= n - 1
ui != vi
1 <= wi <= 1000
All branches are reachable from each other by traveling some roads.
"""
class Solution:
    def numberOfSets(self, n: int, maxDistance: int, roads: List[List[int]]) -> int:

There is a company with n branches across the country, some of which are connected by roads. Initially, all branches are reachable from each other by traveling some roads.
The company has realized that they are spending an excessive amount of time traveling between their branches. As a result, they have decided to close down some of these branches (possibly none). However, they want to ensure that the remaining branches have a distance of at most maxDistance from each other.
The distance between two branches is the minimum total traveled length needed to reach one branch from another.
You are given integers n, maxDistance, and a 0-indexed 2D array roads, where roads[i] = [ui, vi, wi] represents the undirected road between branches ui and vi with length wi.
Return the number of possible sets of closing branches, so that any branch has a distance of at most maxDistance from any other.
Note that, after closing a branch, the company will no longer have access to any roads connected to it.
Note that, multiple roads are allowed.

Example 1:

Input: n = 3, maxDistance = 5, roads = [[0,1,2],[1,2,10],[0,2,10]]
Output: 5
Explanation: The possible sets of closing branches are:
- The set [2], after closing, active branches are [0,1] and they are reachable to each other within distance 2.
- The set [0,1], after closing, the active branch is [2].
- The set [1,2], after closing, the active branch is [0].
- The set [0,2], after closing, the active branch is [1].
- The set [0,1,2], after closing, there are no active branches.
It can be proven, that there are only 5 possible sets of closing branches.

Example 2:

Input: n = 3, maxDistance = 5, roads = [[0,1,20],[0,1,10],[1,2,2],[0,2,2]]
Output: 7
Explanation: The possible sets of closing branches are:
- The set [], after closing, active branches are [0,1,2] and they are reachable to each other within distance 4.
- The set [0], after closing, active branches are [1,2] and they are reachable to each other within distance 2.
- The set [1], after closing, active branches are [0,2] and they are reachable to each other within distance 2.
- The set [0,1], after closing, the active branch is [2].
- The set [1,2], after closing, the active branch is [0].
- The set [0,2], after closing, the active branch is [1].
- The set [0,1,2], after closing, there are no active branches.
It can be proven, that there are only 7 possible sets of closing branches.

Example 3:

Input: n = 1, maxDistance = 10, roads = []
Output: 2
Explanation: The possible sets of closing branches are:
- The set [], after closing, the active branch is [0].
- The set [0], after closing, there are no active branches.
It can be proven, that there are only 2 possible sets of closing branches.

Constraints:

1 <= n <= 10
1 <= maxDistance <= 105
0 <= roads.length <= 1000
roads[i].length == 3
0 <= ui, vi <= n - 1
ui != vi
1 <= wi <= 1000
All branches are reachable from each other by traveling some roads.

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

```

my_solution = Solution()

test_input = { "n": 3, "maxDistance": 5, "roads": [[0,1,2],[1,2,10],[0,2,10]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 3, "maxDistance": 5, "roads": [[0,1,20],[0,1,10],[1,2,2],[0,2,2]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 1, "maxDistance": 10, "roads": [] }
assert my_solution.numberOfSets(**test_input) == 2

test_input = { "n": 3, "maxDistance": 12, "roads": [[1,0,11],[1,0,16],[0,2,13]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 3, "maxDistance": 3, "roads": [[2,0,14],[1,0,15],[1,0,7]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 3, "maxDistance": 19, "roads": [[1,0,7],[0,2,18]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 3, "maxDistance": 5, "roads": [[2,0,4],[1,0,3],[1,0,2]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 4, "maxDistance": 3, "roads": [[2,1,8],[1,0,3],[0,3,8]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 5, "maxDistance": 20, "roads": [[3,2,20],[1,0,10],[0,2,19],[0,3,13],[0,4,19]] }
assert my_solution.numberOfSets(**test_input) == 12

test_input = { "n": 2, "maxDistance": 30, "roads": [[1,0,33]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 3, "maxDistance": 12, "roads": [[2,1,4],[0,1,4],[0,2,6]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 3, "maxDistance": 3, "roads": [[1,0,4],[0,2,5]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 3, "maxDistance": 27, "roads": [[2,1,23],[0,1,14],[0,2,18]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 4, "maxDistance": 20, "roads": [[2,0,16],[0,1,13],[0,3,11]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 3, "maxDistance": 22, "roads": [[1,0,21],[2,1,28]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 2, "maxDistance": 2, "roads": [[1,0,6]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 3, "maxDistance": 22, "roads": [[1,0,16],[1,0,12],[0,2,14]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 2, "maxDistance": 8, "roads": [[1,0,9]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 2, "maxDistance": 18, "roads": [[1,0,3]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 4, "maxDistance": 27, "roads": [[3,2,3],[0,1,27],[0,2,6],[0,3,17]] }
assert my_solution.numberOfSets(**test_input) == 10

test_input = { "n": 5, "maxDistance": 14, "roads": [[1,0,13],[2,0,19],[0,3,16],[0,4,18]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 5, "maxDistance": 8, "roads": [[1,0,3],[3,1,10],[4,0,6],[2,0,9],[3,2,11],[4,0,12]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 2, "maxDistance": 4, "roads": [[1,0,7]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 4, "maxDistance": 39, "roads": [[2,0,44],[3,2,42],[2,1,45]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 5, "maxDistance": 2, "roads": [[4,1,11],[3,1,5],[1,0,4],[0,2,7]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 3, "maxDistance": 9, "roads": [[1,0,17],[0,2,22]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 2, "maxDistance": 1, "roads": [[1,0,3]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 3, "maxDistance": 39, "roads": [[1,0,28],[0,2,35]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 4, "maxDistance": 17, "roads": [[2,1,28],[2,0,6],[1,0,28],[1,0,24],[1,0,18],[1,0,25],[0,3,10]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 5, "maxDistance": 16, "roads": [[2,1,27],[3,0,22],[2,1,4],[1,0,11],[2,1,48],[1,0,40],[4,2,33],[4,3,44],[1,0,1]] }
assert my_solution.numberOfSets(**test_input) == 9

test_input = { "n": 3, "maxDistance": 23, "roads": [[2,1,20],[0,1,12],[0,2,10]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 5, "maxDistance": 3, "roads": [[4,0,5],[1,0,2],[3,0,5],[3,0,4],[4,2,5],[4,2,1]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 3, "maxDistance": 5, "roads": [[1,0,6],[2,0,7]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 3, "maxDistance": 21, "roads": [[2,1,30],[0,1,36],[0,2,44]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 5, "maxDistance": 25, "roads": [[1,0,17],[1,0,1],[2,1,24],[3,2,12],[1,0,7],[3,2,4],[2,1,15],[0,4,14]] }
assert my_solution.numberOfSets(**test_input) == 14

test_input = { "n": 2, "maxDistance": 3, "roads": [[1,0,6]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 3, "maxDistance": 4, "roads": [[1,0,6],[2,1,6],[2,0,2]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 4, "maxDistance": 21, "roads": [[3,2,18],[1,0,15],[2,1,15],[3,0,19],[3,2,19]] }
assert my_solution.numberOfSets(**test_input) == 9

test_input = { "n": 4, "maxDistance": 1, "roads": [[1,0,4],[1,0,2],[3,1,2],[2,1,1],[1,0,3],[2,0,3]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 3, "maxDistance": 33, "roads": [[2,1,2],[1,0,40],[2,1,43]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 4, "maxDistance": 29, "roads": [[2,1,20],[1,0,38],[2,1,15],[2,0,32],[0,3,18]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 3, "maxDistance": 1, "roads": [[2,1,4],[2,0,2],[1,0,12]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 2, "maxDistance": 2, "roads": [[1,0,3]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 3, "maxDistance": 13, "roads": [[1,0,18],[2,0,1],[2,1,2]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 3, "maxDistance": 1, "roads": [[1,0,23],[0,2,37]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 3, "maxDistance": 18, "roads": [[2,0,39],[0,1,47]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 4, "maxDistance": 6, "roads": [[3,0,6],[0,1,3],[0,2,9]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 3, "maxDistance": 35, "roads": [[1,0,10],[1,0,15],[0,2,32]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 5, "maxDistance": 10, "roads": [[4,0,38],[4,0,11],[2,0,24],[3,0,5],[2,1,18],[2,0,38],[1,0,7],[2,1,3],[2,1,2],[3,1,36]] }
assert my_solution.numberOfSets(**test_input) == 10

test_input = { "n": 5, "maxDistance": 16, "roads": [[2,0,32],[4,0,17],[2,0,22],[3,1,38],[3,0,13],[3,1,34],[3,1,36],[1,0,36],[3,1,18],[3,2,10]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 2, "maxDistance": 4, "roads": [[1,0,18]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 5, "maxDistance": 13, "roads": [[3,0,5],[2,1,3],[1,0,6],[3,2,19],[2,1,29],[2,1,30],[1,0,5],[2,0,29],[4,3,15],[2,1,23]] }
assert my_solution.numberOfSets(**test_input) == 12

test_input = { "n": 3, "maxDistance": 23, "roads": [[2,1,12],[1,0,8],[2,1,7]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 5, "maxDistance": 38, "roads": [[2,0,8],[2,1,10],[0,3,25],[0,4,48]] }
assert my_solution.numberOfSets(**test_input) == 11

test_input = { "n": 2, "maxDistance": 4, "roads": [[1,0,2]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 4, "maxDistance": 12, "roads": [[2,1,18],[0,1,25],[0,2,24],[0,3,16]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 4, "maxDistance": 1, "roads": [[2,0,1],[3,2,2],[2,0,2],[2,0,1],[1,0,1],[1,0,1]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 3, "maxDistance": 1, "roads": [[1,0,1],[0,2,1]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 2, "maxDistance": 3, "roads": [[1,0,24]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 2, "maxDistance": 10, "roads": [[1,0,13]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 3, "maxDistance": 1, "roads": [[2,1,1],[0,1,1],[0,2,1]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 5, "maxDistance": 13, "roads": [[1,0,17],[1,0,21],[3,0,9],[1,0,10],[2,0,11],[4,1,12],[2,1,11],[1,0,18]] }
assert my_solution.numberOfSets(**test_input) == 12

test_input = { "n": 2, "maxDistance": 19, "roads": [[1,0,28]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 3, "maxDistance": 8, "roads": [[2,0,7],[2,0,28],[0,1,34]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 5, "maxDistance": 7, "roads": [[1,0,32],[0,2,35],[0,3,20],[0,4,27]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 4, "maxDistance": 1, "roads": [[1,0,4],[1,0,3],[3,0,4],[1,0,7],[0,2,11]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 2, "maxDistance": 34, "roads": [[1,0,11]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 5, "maxDistance": 10, "roads": [[2,1,32],[4,3,14],[3,2,3],[2,1,21],[3,1,37],[2,1,30],[0,1,18],[0,2,26],[0,3,19],[0,4,23]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 5, "maxDistance": 14, "roads": [[2,0,19],[3,1,24],[4,3,10],[4,1,15],[0,1,21],[0,3,21],[0,4,12]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 4, "maxDistance": 30, "roads": [[2,0,5],[0,1,27],[0,3,24]] }
assert my_solution.numberOfSets(**test_input) == 9

test_input = { "n": 2, "maxDistance": 6, "roads": [[1,0,23]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 5, "maxDistance": 6, "roads": [[4,0,17],[2,1,7],[4,1,23],[1,0,1],[1,0,19],[0,3,20]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 3, "maxDistance": 5, "roads": [[1,0,1],[1,0,3],[2,0,4]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 4, "maxDistance": 19, "roads": [[3,2,21],[2,1,3],[0,1,15],[0,2,22],[0,3,8]] }
assert my_solution.numberOfSets(**test_input) == 9

test_input = { "n": 2, "maxDistance": 5, "roads": [[1,0,4]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 4, "maxDistance": 18, "roads": [[2,1,7],[2,0,5],[0,3,10]] }
assert my_solution.numberOfSets(**test_input) == 10

test_input = { "n": 5, "maxDistance": 35, "roads": [[1,0,39],[1,0,3],[3,1,45],[2,0,21],[3,2,40],[3,0,27],[2,1,44],[4,2,6],[4,2,45],[3,0,22]] }
assert my_solution.numberOfSets(**test_input) == 14

test_input = { "n": 4, "maxDistance": 2, "roads": [[1,0,2],[1,0,3],[1,0,15],[1,0,7],[0,2,4],[0,3,6]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 4, "maxDistance": 5, "roads": [[2,0,1],[1,0,3],[0,3,4]] }
assert my_solution.numberOfSets(**test_input) == 10

test_input = { "n": 3, "maxDistance": 19, "roads": [[1,0,9],[0,2,4]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 4, "maxDistance": 1, "roads": [[3,0,4],[2,1,4],[1,0,4]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 2, "maxDistance": 29, "roads": [[1,0,18]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 2, "maxDistance": 11, "roads": [[1,0,28]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 2, "maxDistance": 12, "roads": [[1,0,10]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 5, "maxDistance": 9, "roads": [[3,2,23],[4,3,11],[1,0,16],[2,0,11],[2,0,16],[1,0,20],[4,0,16],[2,0,36],[3,0,7]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 5, "maxDistance": 17, "roads": [[3,2,22],[3,2,3],[4,0,19],[3,0,21],[4,3,4],[1,0,24],[3,0,7],[3,2,12],[1,0,17]] }
assert my_solution.numberOfSets(**test_input) == 14

test_input = { "n": 4, "maxDistance": 5, "roads": [[2,0,26],[1,0,15],[3,2,17]] }
assert my_solution.numberOfSets(**test_input) == 5

test_input = { "n": 4, "maxDistance": 4, "roads": [[1,0,11],[0,2,3],[0,3,3]] }
assert my_solution.numberOfSets(**test_input) == 7

test_input = { "n": 5, "maxDistance": 13, "roads": [[3,1,16],[0,1,3],[0,2,19],[0,3,10],[0,4,2]] }
assert my_solution.numberOfSets(**test_input) == 13

test_input = { "n": 4, "maxDistance": 5, "roads": [[1,0,21],[1,0,13],[1,0,19],[2,1,15],[1,0,17],[1,0,3],[0,3,1]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 5, "maxDistance": 25, "roads": [[1,0,18],[3,0,20],[2,0,17],[2,1,21],[0,4,3]] }
assert my_solution.numberOfSets(**test_input) == 16

test_input = { "n": 5, "maxDistance": 15, "roads": [[2,1,33],[1,0,18],[2,0,16],[3,1,37],[3,0,26],[0,4,18]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 4, "maxDistance": 1, "roads": [[1,0,1],[1,0,1],[0,2,1],[0,3,1]] }
assert my_solution.numberOfSets(**test_input) == 8

test_input = { "n": 4, "maxDistance": 10, "roads": [[2,0,22],[2,1,6],[2,0,21],[2,1,27],[3,1,12]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 2, "maxDistance": 13, "roads": [[1,0,21]] }
assert my_solution.numberOfSets(**test_input) == 3

test_input = { "n": 4, "maxDistance": 31, "roads": [[3,1,7],[2,1,10],[2,0,25],[2,0,27]] }
assert my_solution.numberOfSets(**test_input) == 9

test_input = { "n": 3, "maxDistance": 17, "roads": [[1,0,8],[1,0,8],[0,2,14]] }
assert my_solution.numberOfSets(**test_input) == 6

test_input = { "n": 2, "maxDistance": 3, "roads": [[1,0,3]] }
assert my_solution.numberOfSets(**test_input) == 4

test_input = { "n": 5, "maxDistance": 5, "roads": [[4,1,37],[4,1,7],[2,1,6],[3,2,8],[2,1,35],[1,0,28],[4,1,3],[2,1,2]] }
assert my_solution.numberOfSets(**test_input) == 9

test_input = { "n": 4, "maxDistance": 1, "roads": [[2,0,2],[2,0,1],[0,1,2],[0,3,2]] }
assert my_solution.numberOfSets(**test_input) == 6


find-the-peaks

Find the Peaks

Prompt:
"""
You are given a 0-indexed array mountain. Your task is to find all the peaks in the mountain array.
Return an array that consists of indices of peaks in the given array in any order.
Notes:

A peak is defined as an element that is strictly greater than its neighboring elements.
The first and last elements of the array are not a peak.

Example 1:

Input: mountain = [2,4,4]
Output: []
Explanation: mountain[0] and mountain[2] can not be a peak because they are first and last elements of the array.
mountain[1] also can not be a peak because it is not strictly greater than mountain[2].
So the answer is [].

Example 2:

Input: mountain = [1,4,3,8,5]
Output: [1,3]
Explanation: mountain[0] and mountain[4] can not be a peak because they are first and last elements of the array.
mountain[2] also can not be a peak because it is not strictly greater than mountain[3] and mountain[1].
But mountain [1] and mountain[3] are strictly greater than their neighboring elements.
So the answer is [1,3].

Constraints:

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

You are given a 0-indexed array mountain. Your task is to find all the peaks in the mountain array.
Return an array that consists of indices of peaks in the given array in any order.
Notes:

A peak is defined as an element that is strictly greater than its neighboring elements.
The first and last elements of the array are not a peak.

Example 1:

Input: mountain = [2,4,4]
Output: []
Explanation: mountain[0] and mountain[2] can not be a peak because they are first and last elements of the array.
mountain[1] also can not be a peak because it is not strictly greater than mountain[2].
So the answer is [].

Example 2:

Input: mountain = [1,4,3,8,5]
Output: [1,3]
Explanation: mountain[0] and mountain[4] can not be a peak because they are first and last elements of the array.
mountain[2] also can not be a peak because it is not strictly greater than mountain[3] and mountain[1].
But mountain [1] and mountain[3] are strictly greater than their neighboring elements.
So the answer is [1,3].

Constraints:

3 <= mountain.length <= 100
1 <= mountain[i] <= 100

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "mountain": [2,3,6] }
assert my_solution.findPeaks(**test_input) == []

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

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

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

test_input = { "mountain": [3,3,3] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [3,3,5] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [3,4,6] }
assert my_solution.findPeaks(**test_input) == []

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

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

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

test_input = { "mountain": [3,5,6] }
assert my_solution.findPeaks(**test_input) == []

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

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

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

test_input = { "mountain": [4,2,6] }
assert my_solution.findPeaks(**test_input) == []

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

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

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

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

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

test_input = { "mountain": [4,6,6] }
assert my_solution.findPeaks(**test_input) == []

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

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

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

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

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

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

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

test_input = { "mountain": [5,5,6] }
assert my_solution.findPeaks(**test_input) == []

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

test_input = { "mountain": [5,6,4] }
assert my_solution.findPeaks(**test_input) == [1]

test_input = { "mountain": [6,1,1] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,1,2] }
assert my_solution.findPeaks(**test_input) == []

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

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

test_input = { "mountain": [6,2,5] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,3,2] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,3,3] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,3,6] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,4,3] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,5,2] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,5,4] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [6,6,4] }
assert my_solution.findPeaks(**test_input) == []

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

test_input = { "mountain": [1,1,7,7] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [1,3,6,5] }
assert my_solution.findPeaks(**test_input) == [2]

test_input = { "mountain": [1,4,7,8] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [1,6,6,6] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [1,8,1,8] }
assert my_solution.findPeaks(**test_input) == [1]

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

test_input = { "mountain": [2,3,7,6] }
assert my_solution.findPeaks(**test_input) == [2]

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

test_input = { "mountain": [2,7,1,2] }
assert my_solution.findPeaks(**test_input) == [1]

test_input = { "mountain": [2,7,2,6] }
assert my_solution.findPeaks(**test_input) == [1]

test_input = { "mountain": [2,7,5,3] }
assert my_solution.findPeaks(**test_input) == [1]

test_input = { "mountain": [2,7,7,6] }
assert my_solution.findPeaks(**test_input) == []

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

test_input = { "mountain": [3,3,4,2] }
assert my_solution.findPeaks(**test_input) == [2]

test_input = { "mountain": [3,3,7,8] }
assert my_solution.findPeaks(**test_input) == []

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

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

test_input = { "mountain": [3,4,7,6] }
assert my_solution.findPeaks(**test_input) == [2]

test_input = { "mountain": [3,5,5,3] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [3,6,4,7] }
assert my_solution.findPeaks(**test_input) == [1]

test_input = { "mountain": [3,8,5,5] }
assert my_solution.findPeaks(**test_input) == [1]

test_input = { "mountain": [4,2,4,3] }
assert my_solution.findPeaks(**test_input) == [2]

test_input = { "mountain": [4,2,6,8] }
assert my_solution.findPeaks(**test_input) == []

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

test_input = { "mountain": [4,4,8,7] }
assert my_solution.findPeaks(**test_input) == [2]

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

test_input = { "mountain": [4,6,1,7] }
assert my_solution.findPeaks(**test_input) == [1]

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

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

test_input = { "mountain": [5,1,7,6] }
assert my_solution.findPeaks(**test_input) == [2]

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

test_input = { "mountain": [5,3,6,3] }
assert my_solution.findPeaks(**test_input) == [2]

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

test_input = { "mountain": [5,4,4,6] }
assert my_solution.findPeaks(**test_input) == []

test_input = { "mountain": [5,4,4,8] }
assert my_solution.findPeaks(**test_input) == []

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

test_input = { "mountain": [5,5,8,2] }
assert my_solution.findPeaks(**test_input) == [2]

test_input = { "mountain": [5,6,7,4] }
assert my_solution.findPeaks(**test_input) == [2]

test_input = { "mountain": [5,7,4,3] }
assert my_solution.findPeaks(**test_input) == [1]

test_input = { "mountain": [5,8,7,8] }
assert my_solution.findPeaks(**test_input) == [1]

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


minimum-number-of-coins-to-be-added

Minimum Number of Coins to be Added

Prompt:
"""
You are given a 0-indexed integer array coins, representing the values of the coins available, and an integer target.
An integer x is obtainable if there exists a subsequence of coins that sums to x.
Return the minimum number of coins of any value that need to be added to the array so that every integer in the range [1, target] is obtainable.
A subsequence of an array is a new non-empty array that is formed from the original array by deleting some (possibly none) of the elements without disturbing the relative positions of the remaining elements.

Example 1:

Input: coins = [1,4,10], target = 19
Output: 2
Explanation: We need to add coins 2 and 8. The resulting array will be [1,2,4,8,10].
It can be shown that all integers from 1 to 19 are obtainable from the resulting array, and that 2 is the minimum number of coins that need to be added to the array.

Example 2:

Input: coins = [1,4,10,5,7,19], target = 19
Output: 1
Explanation: We only need to add the coin 2. The resulting array will be [1,2,4,5,7,10,19].
It can be shown that all integers from 1 to 19 are obtainable from the resulting array, and that 1 is the minimum number of coins that need to be added to the array.

Example 3:

Input: coins = [1,1,1], target = 20
Output: 3
Explanation: We need to add coins 4, 8, and 16. The resulting array will be [1,1,1,4,8,16].
It can be shown that all integers from 1 to 20 are obtainable from the resulting array, and that 3 is the minimum number of coins that need to be added to the array.

Constraints:

1 <= target <= 105
1 <= coins.length <= 105
1 <= coins[i] <= target
"""
class Solution:
    def minimumAddedCoins(self, coins: List[int], target: int) -> int:

You are given a 0-indexed integer array coins, representing the values of the coins available, and an integer target.
An integer x is obtainable if there exists a subsequence of coins that sums to x.
Return the minimum number of coins of any value that need to be added to the array so that every integer in the range [1, target] is obtainable.
A subsequence of an array is a new non-empty array that is formed from the original array by deleting some (possibly none) of the elements without disturbing the relative positions of the remaining elements.

Example 1:

Input: coins = [1,4,10], target = 19
Output: 2
Explanation: We need to add coins 2 and 8. The resulting array will be [1,2,4,8,10].
It can be shown that all integers from 1 to 19 are obtainable from the resulting array, and that 2 is the minimum number of coins that need to be added to the array.

Example 2:

Input: coins = [1,4,10,5,7,19], target = 19
Output: 1
Explanation: We only need to add the coin 2. The resulting array will be [1,2,4,5,7,10,19].
It can be shown that all integers from 1 to 19 are obtainable from the resulting array, and that 1 is the minimum number of coins that need to be added to the array.

Example 3:

Input: coins = [1,1,1], target = 20
Output: 3
Explanation: We need to add coins 4, 8, and 16. The resulting array will be [1,1,1,4,8,16].
It can be shown that all integers from 1 to 20 are obtainable from the resulting array, and that 3 is the minimum number of coins that need to be added to the array.

Constraints:

1 <= target <= 105
1 <= coins.length <= 105
1 <= coins[i] <= target

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

```

my_solution = Solution()

test_input = { "coins": [1,4,10], "target": 19 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [1,4,10,5,7,19], "target": 19 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [1,1,1], "target": 20 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [1], "target": 100000 }
assert my_solution.minimumAddedCoins(**test_input) == 16

test_input = { "coins": [100000], "target": 100000 }
assert my_solution.minimumAddedCoins(**test_input) == 17

test_input = { "coins": [2], "target": 5 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [5,6,7], "target": 10 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [5,6,7], "target": 15 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [4,11,13,15,7,5,12,11,5,9], "target": 34 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [8,12,9], "target": 27 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [2,13,7,1,11], "target": 35 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [10,3,5,11,6], "target": 27 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [6,6,6,15,4], "target": 31 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [6,15,6], "target": 22 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [8,14,15,4,14,15,8,10,8], "target": 42 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [9,14,14,9,14,5,12,10,11], "target": 17 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [14,5,13,3,7,10,10,10], "target": 32 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [8,6,7,12], "target": 26 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [15,1,12], "target": 43 }
assert my_solution.minimumAddedCoins(**test_input) == 4

test_input = { "coins": [4,1,4,10], "target": 16 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [10,2,13,5,7,15], "target": 26 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [10,1,10], "target": 10 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [9,5,13,8], "target": 30 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [13,9,4,5], "target": 37 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [1,15,5,12,13,10,14,8,1,7], "target": 29 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [14,14,6,2,9,1,4,10], "target": 38 }
assert my_solution.minimumAddedCoins(**test_input) == 0

test_input = { "coins": [7,10,6,14,10,11,2], "target": 45 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [6,3,2,6,8,9,13,3,12,13], "target": 47 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [8,1,9,2,15], "target": 34 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [5,13,9,11,6,1], "target": 27 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [10,15,7,14,2,2,12,14,13], "target": 45 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [9,3,10,3,8,2,7,11,1], "target": 26 }
assert my_solution.minimumAddedCoins(**test_input) == 0

test_input = { "coins": [9,11,2,5,2,7,11], "target": 28 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [5,5,15,3,13], "target": 17 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [2,2,9,10,7,15,4,3,9,15], "target": 16 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [3,1,12,15,5,10], "target": 34 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [12,7,5,2,12], "target": 50 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [11,6,10,3,1,7,11], "target": 44 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [13,12,1,11,3,4,11,9,13,13], "target": 41 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [6,4,1,9,9,2,10,7], "target": 48 }
assert my_solution.minimumAddedCoins(**test_input) == 0

test_input = { "coins": [10,4,4,3,9,6,8,4,7,7], "target": 22 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [15,9,5,7,4,13], "target": 19 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [13,11,8,6,11], "target": 16 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [8,14,15,9,8,10,13,7,3], "target": 42 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [6,14,7,4,10,9,10,9,7], "target": 22 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [4,6,7,15,13,14,5,7], "target": 16 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [10,12,5], "target": 32 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [8,5,14,13,13,11,14,13], "target": 43 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [3,14,4,2,10,3,7], "target": 50 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [1,3,11,9,2,10,6,12], "target": 12 }
assert my_solution.minimumAddedCoins(**test_input) == 0

test_input = { "coins": [2,5,4,12,6,7,11,15], "target": 17 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [7,12,10,15,6,15,14,2,9,12], "target": 24 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [4,7,15,10,14], "target": 38 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [10,1,12,9], "target": 16 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [5,8,12,6,15,13,11,5], "target": 35 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [6,2,6], "target": 39 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [15,10,5,4,7,12,12,5,11], "target": 30 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [9,10,7,12,10,4], "target": 35 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [4,4,2], "target": 8 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [13,4,15,1,8], "target": 25 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [14,7,7,1,6,14,3,15,13], "target": 18 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [8,2,14,2,3,10,15,5], "target": 31 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [3,7,12,10,11,5,3], "target": 36 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [5,3,14,8,10], "target": 33 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [9,14,9,14,4,1,4,12,12], "target": 41 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [6,3,9,7,3,4,4,15,15,10], "target": 47 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [4,9,6], "target": 43 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [12,9,13,12,10,4,9,9,4], "target": 28 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [6,8,2,13,1,5,6], "target": 31 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [9,8,9,9,3,5,10,15,1], "target": 45 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [1,10,15,15], "target": 24 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [9,12,2], "target": 43 }
assert my_solution.minimumAddedCoins(**test_input) == 4

test_input = { "coins": [14,13,10,2,2], "target": 16 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [11,5,5,13,4,13,10,3,4], "target": 21 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [8,9,1,5,8,7,6,8,6], "target": 47 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [4,10,9], "target": 18 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [7,9,7,6,8,11], "target": 50 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [11,6,6,14,12,2], "target": 46 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [8,9,2], "target": 31 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [12,1,4,3,5,3], "target": 18 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [4,3,13], "target": 34 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [9,11,3], "target": 22 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [1,11,15,1,10,13,7,6,12], "target": 28 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [1,10,8,7,12], "target": 19 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [1,5,15,13,8,4,5,7], "target": 29 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [3,8,13,8,5,3,7,2,9,8], "target": 50 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [4,13,12], "target": 47 }
assert my_solution.minimumAddedCoins(**test_input) == 4

test_input = { "coins": [9,3,10,9,11], "target": 48 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [8,7,6,1,9,5,5], "target": 13 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [11,9,1,15], "target": 16 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [8,13,8], "target": 27 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [7,10,11,3,10,14], "target": 36 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [14,9,6,11,13,8,8,5,6], "target": 22 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [9,3,6,10,11,1,5,14,3], "target": 27 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [4,5,9,6,2,2,10,5,13], "target": 43 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [3,10,2,13,6,13,14,14,3], "target": 28 }
assert my_solution.minimumAddedCoins(**test_input) == 1

test_input = { "coins": [14,15,15,12,13,4,15], "target": 38 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [10,5,12,11,9,8,1], "target": 12 }
assert my_solution.minimumAddedCoins(**test_input) == 2

test_input = { "coins": [15,13,12,4], "target": 31 }
assert my_solution.minimumAddedCoins(**test_input) == 3

test_input = { "coins": [4,5,14,13,10,12], "target": 31 }
assert my_solution.minimumAddedCoins(**test_input) == 2


count-complete-substrings

Count Complete Substrings

Prompt:
"""
You are given a string word and an integer k.
A substring s of word is complete if:

Each character in s occurs exactly k times.
The difference between two adjacent characters is at most 2. That is, for any two adjacent characters c1 and c2 in s, the absolute difference in their positions in the alphabet is at most 2.

Return the number of complete substrings of word.
A substring is a non-empty contiguous sequence of characters in a string.

Example 1:

Input: word = "igigee", k = 2
Output: 3
Explanation: The complete substrings where each character appears exactly twice and the difference between adjacent characters is at most 2 are: igigee, igigee, igigee.

Example 2:

Input: word = "aaabbbccc", k = 3
Output: 6
Explanation: The complete substrings where each character appears exactly three times and the difference between adjacent characters is at most 2 are: aaabbbccc, aaabbbccc, aaabbbccc, aaabbbccc, aaabbbccc, aaabbbccc.

Constraints:

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

You are given a string word and an integer k.
A substring s of word is complete if:

Each character in s occurs exactly k times.
The difference between two adjacent characters is at most 2. That is, for any two adjacent characters c1 and c2 in s, the absolute difference in their positions in the alphabet is at most 2.

Return the number of complete substrings of word.
A substring is a non-empty contiguous sequence of characters in a string.

Example 1:

Input: word = "igigee", k = 2
Output: 3
Explanation: The complete substrings where each character appears exactly twice and the difference between adjacent characters is at most 2 are: igigee, igigee, igigee.

Example 2:

Input: word = "aaabbbccc", k = 3
Output: 6
Explanation: The complete substrings where each character appears exactly three times and the difference between adjacent characters is at most 2 are: aaabbbccc, aaabbbccc, aaabbbccc, aaabbbccc, aaabbbccc, aaabbbccc.

Constraints:

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

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

```

my_solution = Solution()

test_input = { "word": "igigee", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 3

test_input = { "word": "aaabbbccc", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "a", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "b", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "c", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "aa", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "ab", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "ac", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "ba", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 3

test_input = { "word": "bb", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "bc", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 3

test_input = { "word": "ca", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 3

test_input = { "word": "cb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 3

test_input = { "word": "cc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "aaa", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 3

test_input = { "word": "aab", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "aac", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "aba", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "abb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 4

test_input = { "word": "abc", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "aca", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 5

test_input = { "word": "acb", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "acc", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "baa", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "bab", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bac", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bba", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 4

test_input = { "word": "bbb", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 2

test_input = { "word": "bbc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "bca", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bcb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 5

test_input = { "word": "bcc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "caa", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 4

test_input = { "word": "cab", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "cac", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "cba", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "cbb", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "cbc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "cca", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "ccb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 4

test_input = { "word": "ccc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 2

test_input = { "word": "aaaa", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "aaab", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "aaac", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "aaba", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "aabb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 5

test_input = { "word": "aabc", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "aaca", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "aacb", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "aacc", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "abaa", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "abab", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 7

test_input = { "word": "abac", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "abba", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "abbb", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "abbc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "abca", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 9

test_input = { "word": "abcb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 8

test_input = { "word": "abcc", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "acaa", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "acab", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "acac", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 7

test_input = { "word": "acba", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "acbb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 7

test_input = { "word": "acbc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "acca", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "accb", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "accc", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "baaa", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 2

test_input = { "word": "baab", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "baac", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "baba", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 7

test_input = { "word": "babb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "babc", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "baca", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bacb", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bacc", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 7

test_input = { "word": "bbaa", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 3

test_input = { "word": "bbab", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bbac", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bbba", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bbbb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 4

test_input = { "word": "bbbc", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "bbca", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bbcb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "bbcc", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bcaa", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "bcab", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bcac", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bcba", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 8

test_input = { "word": "bcbb", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "bcbc", "k": 2 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "bcca", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bccb", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "bccc", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "caaa", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 1

test_input = { "word": "caab", "k": 1 }
assert my_solution.countCompleteSubstrings(**test_input) == 6

test_input = { "word": "caac", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "caba", "k": 4 }
assert my_solution.countCompleteSubstrings(**test_input) == 0

test_input = { "word": "cabb", "k": 3 }
assert my_solution.countCompleteSubstrings(**test_input) == 0


count-the-number-of-infection-sequences

Count the Number of Infection Sequences

Prompt:
"""
You are given an integer n and a 0-indexed integer array sick which is sorted in increasing order.
There are n children standing in a queue with positions 0 to n - 1 assigned to them. The array sick contains the positions of the children who are infected with an infectious disease. An infected child at position i can spread the disease to either of its immediate neighboring children at positions i - 1 and i + 1 if they exist and are currently not infected. At most one child who was previously not infected can get infected with the disease in one second.
It can be shown that after a finite number of seconds, all the children in the queue will get infected with the disease. An infection sequence is the sequential order of positions in which all of the non-infected children get infected with the disease. Return the total number of possible infection sequences.
Since the answer may be large, return it modulo 109 + 7.
Note that an infection sequence does not contain positions of children who were already infected with the disease in the beginning.

Example 1:

Input: n = 5, sick = [0,4]
Output: 4
Explanation: Children at positions 1, 2, and 3 are not infected in the beginning. There are 4 possible infection sequences:
- The children at positions 1 and 3 can get infected since their positions are adjacent to the infected children 0 and 4. The child at position 1 gets infected first.
Now, the child at position 2 is adjacent to the child at position 1 who is infected and the child at position 3 is adjacent to the child at position 4 who is infected, hence either of them can get infected. The child at position 2 gets infected.
Finally, the child at position 3 gets infected because it is adjacent to children at positions 2 and 4 who are infected. The infection sequence is [1,2,3].
- The children at positions 1 and 3 can get infected because their positions are adjacent to the infected children 0 and 4. The child at position 1 gets infected first.
Now, the child at position 2 is adjacent to the child at position 1 who is infected and the child at position 3 is adjacent to the child at position 4 who is infected, hence either of them can get infected. The child at position 3 gets infected.
Finally, the child at position 2 gets infected because it is adjacent to children at positions 1 and 3 who are infected. The infection sequence is [1,3,2].
- The infection sequence is [3,1,2]. The order of infection of disease in the children can be seen as: [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4].
- The infection sequence is [3,2,1]. The order of infection of disease in the children can be seen as: [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4].

Example 2:

Input: n = 4, sick = [1]
Output: 3
Explanation: Children at positions 0, 2, and 3 are not infected in the beginning. There are 3 possible infection sequences:
- The infection sequence is [0,2,3]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].
- The infection sequence is [2,0,3]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].
- The infection sequence is [2,3,0]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].

Constraints:

2 <= n <= 105
1 <= sick.length <= n - 1
0 <= sick[i] <= n - 1
sick is sorted in increasing order.
"""
class Solution:
    def numberOfSequence(self, n: int, sick: List[int]) -> int:

You are given an integer n and a 0-indexed integer array sick which is sorted in increasing order.
There are n children standing in a queue with positions 0 to n - 1 assigned to them. The array sick contains the positions of the children who are infected with an infectious disease. An infected child at position i can spread the disease to either of its immediate neighboring children at positions i - 1 and i + 1 if they exist and are currently not infected. At most one child who was previously not infected can get infected with the disease in one second.
It can be shown that after a finite number of seconds, all the children in the queue will get infected with the disease. An infection sequence is the sequential order of positions in which all of the non-infected children get infected with the disease. Return the total number of possible infection sequences.
Since the answer may be large, return it modulo 109 + 7.
Note that an infection sequence does not contain positions of children who were already infected with the disease in the beginning.

Example 1:

Input: n = 5, sick = [0,4]
Output: 4
Explanation: Children at positions 1, 2, and 3 are not infected in the beginning. There are 4 possible infection sequences:
- The children at positions 1 and 3 can get infected since their positions are adjacent to the infected children 0 and 4. The child at position 1 gets infected first.
Now, the child at position 2 is adjacent to the child at position 1 who is infected and the child at position 3 is adjacent to the child at position 4 who is infected, hence either of them can get infected. The child at position 2 gets infected.
Finally, the child at position 3 gets infected because it is adjacent to children at positions 2 and 4 who are infected. The infection sequence is [1,2,3].
- The children at positions 1 and 3 can get infected because their positions are adjacent to the infected children 0 and 4. The child at position 1 gets infected first.
Now, the child at position 2 is adjacent to the child at position 1 who is infected and the child at position 3 is adjacent to the child at position 4 who is infected, hence either of them can get infected. The child at position 3 gets infected.
Finally, the child at position 2 gets infected because it is adjacent to children at positions 1 and 3 who are infected. The infection sequence is [1,3,2].
- The infection sequence is [3,1,2]. The order of infection of disease in the children can be seen as: [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4].
- The infection sequence is [3,2,1]. The order of infection of disease in the children can be seen as: [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4] => [0,1,2,3,4].

Example 2:

Input: n = 4, sick = [1]
Output: 3
Explanation: Children at positions 0, 2, and 3 are not infected in the beginning. There are 3 possible infection sequences:
- The infection sequence is [0,2,3]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].
- The infection sequence is [2,0,3]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].
- The infection sequence is [2,3,0]. The order of infection of disease in the children can be seen as: [0,1,2,3] => [0,1,2,3] => [0,1,2,3] => [0,1,2,3].

Constraints:

2 <= n <= 105
1 <= sick.length <= n - 1
0 <= sick[i] <= n - 1
sick is sorted in increasing order.

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

```

my_solution = Solution()

test_input = { "n": 5, "sick": [0,4] }
assert my_solution.numberOfSequence(**test_input) == 4

test_input = { "n": 4, "sick": [1] }
assert my_solution.numberOfSequence(**test_input) == 3

test_input = { "n": 2, "sick": [0] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 5, "sick": [0] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 100, "sick": [0] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 2, "sick": [1] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 5, "sick": [1] }
assert my_solution.numberOfSequence(**test_input) == 4

test_input = { "n": 5, "sick": [2] }
assert my_solution.numberOfSequence(**test_input) == 6

test_input = { "n": 5, "sick": [3] }
assert my_solution.numberOfSequence(**test_input) == 4

test_input = { "n": 5, "sick": [4] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 5, "sick": [0,1] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 3, "sick": [0,2] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 5, "sick": [0,2] }
assert my_solution.numberOfSequence(**test_input) == 3

test_input = { "n": 5, "sick": [0,3] }
assert my_solution.numberOfSequence(**test_input) == 6

test_input = { "n": 5, "sick": [1,2] }
assert my_solution.numberOfSequence(**test_input) == 3

test_input = { "n": 5, "sick": [1,3] }
assert my_solution.numberOfSequence(**test_input) == 6

test_input = { "n": 5, "sick": [1,4] }
assert my_solution.numberOfSequence(**test_input) == 6

test_input = { "n": 5, "sick": [2,3] }
assert my_solution.numberOfSequence(**test_input) == 3

test_input = { "n": 5, "sick": [2,4] }
assert my_solution.numberOfSequence(**test_input) == 3

test_input = { "n": 5, "sick": [3,4] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 5, "sick": [0,1,2] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 5, "sick": [0,1,3] }
assert my_solution.numberOfSequence(**test_input) == 2

test_input = { "n": 5, "sick": [0,1,4] }
assert my_solution.numberOfSequence(**test_input) == 2

test_input = { "n": 5, "sick": [0,2,3] }
assert my_solution.numberOfSequence(**test_input) == 2

test_input = { "n": 5, "sick": [0,2,4] }
assert my_solution.numberOfSequence(**test_input) == 2

test_input = { "n": 5, "sick": [0,3,4] }
assert my_solution.numberOfSequence(**test_input) == 2

test_input = { "n": 5, "sick": [1,2,3] }
assert my_solution.numberOfSequence(**test_input) == 2

test_input = { "n": 5, "sick": [1,2,4] }
assert my_solution.numberOfSequence(**test_input) == 2

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

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

test_input = { "n": 5, "sick": [0,1,2,3] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 10, "sick": [0,1,2,3] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 5, "sick": [0,1,2,4] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 10, "sick": [0,1,2,4] }
assert my_solution.numberOfSequence(**test_input) == 6

test_input = { "n": 10, "sick": [0,1,2,5] }
assert my_solution.numberOfSequence(**test_input) == 30

test_input = { "n": 10, "sick": [0,1,2,8] }
assert my_solution.numberOfSequence(**test_input) == 96

test_input = { "n": 10, "sick": [0,1,2,9] }
assert my_solution.numberOfSequence(**test_input) == 32

test_input = { "n": 5, "sick": [0,1,3,4] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 10, "sick": [0,1,3,5] }
assert my_solution.numberOfSequence(**test_input) == 30

test_input = { "n": 10, "sick": [0,1,3,6] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,1,3,7] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,1,3,8] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,1,4,5] }
assert my_solution.numberOfSequence(**test_input) == 30

test_input = { "n": 10, "sick": [0,1,4,6] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,1,4,7] }
assert my_solution.numberOfSequence(**test_input) == 360

test_input = { "n": 10, "sick": [0,1,4,8] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,1,4,9] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,1,5,6] }
assert my_solution.numberOfSequence(**test_input) == 80

test_input = { "n": 10, "sick": [0,1,5,7] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,1,5,8] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,1,5,9] }
assert my_solution.numberOfSequence(**test_input) == 320

test_input = { "n": 10, "sick": [0,1,6,7] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,1,6,8] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,1,6,9] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,1,7,8] }
assert my_solution.numberOfSequence(**test_input) == 96

test_input = { "n": 10, "sick": [0,1,7,9] }
assert my_solution.numberOfSequence(**test_input) == 96

test_input = { "n": 10, "sick": [0,1,8,9] }
assert my_solution.numberOfSequence(**test_input) == 32

test_input = { "n": 5, "sick": [0,2,3,4] }
assert my_solution.numberOfSequence(**test_input) == 1

test_input = { "n": 10, "sick": [0,2,3,4] }
assert my_solution.numberOfSequence(**test_input) == 6

test_input = { "n": 10, "sick": [0,2,3,5] }
assert my_solution.numberOfSequence(**test_input) == 30

test_input = { "n": 10, "sick": [0,2,3,6] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,2,3,7] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,2,3,8] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,2,3,9] }
assert my_solution.numberOfSequence(**test_input) == 96

test_input = { "n": 10, "sick": [0,2,4,5] }
assert my_solution.numberOfSequence(**test_input) == 30

test_input = { "n": 10, "sick": [0,2,4,6] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,2,4,7] }
assert my_solution.numberOfSequence(**test_input) == 360

test_input = { "n": 10, "sick": [0,2,4,8] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,2,4,9] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,2,5,6] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,2,5,7] }
assert my_solution.numberOfSequence(**test_input) == 360

test_input = { "n": 10, "sick": [0,2,5,8] }
assert my_solution.numberOfSequence(**test_input) == 720

test_input = { "n": 10, "sick": [0,2,5,9] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,2,6,7] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,2,6,8] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,2,7,8] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,2,7,9] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,2,8,9] }
assert my_solution.numberOfSequence(**test_input) == 96

test_input = { "n": 10, "sick": [0,3,4,5] }
assert my_solution.numberOfSequence(**test_input) == 30

test_input = { "n": 10, "sick": [0,3,4,7] }
assert my_solution.numberOfSequence(**test_input) == 360

test_input = { "n": 10, "sick": [0,3,4,8] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,3,4,9] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,3,5,6] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,3,5,7] }
assert my_solution.numberOfSequence(**test_input) == 360

test_input = { "n": 10, "sick": [0,3,6,7] }
assert my_solution.numberOfSequence(**test_input) == 360

test_input = { "n": 10, "sick": [0,3,6,8] }
assert my_solution.numberOfSequence(**test_input) == 720

test_input = { "n": 10, "sick": [0,3,6,9] }
assert my_solution.numberOfSequence(**test_input) == 720

test_input = { "n": 10, "sick": [0,3,7,8] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,3,7,9] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,3,8,9] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,4,5,6] }
assert my_solution.numberOfSequence(**test_input) == 80

test_input = { "n": 10, "sick": [0,4,5,7] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,4,5,9] }
assert my_solution.numberOfSequence(**test_input) == 320

test_input = { "n": 10, "sick": [0,4,6,7] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,4,6,8] }
assert my_solution.numberOfSequence(**test_input) == 480

test_input = { "n": 10, "sick": [0,4,8,9] }
assert my_solution.numberOfSequence(**test_input) == 320

test_input = { "n": 10, "sick": [0,5,6,7] }
assert my_solution.numberOfSequence(**test_input) == 120

test_input = { "n": 10, "sick": [0,5,6,9] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,5,7,8] }
assert my_solution.numberOfSequence(**test_input) == 240

test_input = { "n": 10, "sick": [0,5,7,9] }
assert my_solution.numberOfSequence(**test_input) == 240


matrix-similarity-after-cyclic-shifts

Matrix Similarity After Cyclic Shifts

Prompt:
"""
You are given a 0-indexed m x n integer matrix mat and an integer k. You have to cyclically right shift odd indexed rows k times and cyclically left shift even indexed rows k times.
Return true if the initial and final matrix are exactly the same and false otherwise.

Example 1:

Input: mat = [[1,2,1,2],[5,5,5,5],[6,3,6,3]], k = 2
Output: true
Explanation:

Initially, the matrix looks like the first figure.
Second figure represents the state of the matrix after one right and left cyclic shifts to even and odd indexed rows.
Third figure is the final state of the matrix after two cyclic shifts which is similar to the initial matrix.
Therefore, return true.

Example 2:

Input: mat = [[2,2],[2,2]], k = 3
Output: true
Explanation: As all the values are equal in the matrix, even after performing cyclic shifts the matrix will remain the same. Therefeore, we return true.

Example 3:

Input: mat = [[1,2]], k = 1
Output: false
Explanation: After one cyclic shift, mat = [[2,1]] which is not equal to the initial matrix. Therefore we return false.

Constraints:

1 <= mat.length <= 25
1 <= mat[i].length <= 25
1 <= mat[i][j] <= 25
1 <= k <= 50
"""
class Solution:
    def areSimilar(self, mat: List[List[int]], k: int) -> bool:

You are given a 0-indexed m x n integer matrix mat and an integer k. You have to cyclically right shift odd indexed rows k times and cyclically left shift even indexed rows k times.
Return true if the initial and final matrix are exactly the same and false otherwise.

Example 1:

Input: mat = [[1,2,1,2],[5,5,5,5],[6,3,6,3]], k = 2
Output: true
Explanation:

Initially, the matrix looks like the first figure.
Second figure represents the state of the matrix after one right and left cyclic shifts to even and odd indexed rows.
Third figure is the final state of the matrix after two cyclic shifts which is similar to the initial matrix.
Therefore, return true.

Example 2:

Input: mat = [[2,2],[2,2]], k = 3
Output: true
Explanation: As all the values are equal in the matrix, even after performing cyclic shifts the matrix will remain the same. Therefeore, we return true.

Example 3:

Input: mat = [[1,2]], k = 1
Output: false
Explanation: After one cyclic shift, mat = [[2,1]] which is not equal to the initial matrix. Therefore we return false.

Constraints:

1 <= mat.length <= 25
1 <= mat[i].length <= 25
1 <= mat[i][j] <= 25
1 <= k <= 50

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

```