minimum-operations-to-make-a-special-number

Minimum Operations to Make a Special Number

Prompt:
"""
You are given a 0-indexed string num representing a non-negative integer.

In one operation, you can pick any digit of num and delete it. Note that if you delete all the digits of num, num becomes 0.

Return the minimum number of operations required to make num special.

An integer x is considered special if it is divisible by 25.

Example 1:

Input: num = "2245047"
Output: 2
Explanation: Delete digits num[5] and num[6]. The resulting number is "22450" which is special since it is divisible by 25.
It can be shown that 2 is the minimum number of operations required to get a special number.

Example 2:

Input: num = "2908305"
Output: 3
Explanation: Delete digits num[3], num[4], and num[6]. The resulting number is "2900" which is special since it is divisible by 25.
It can be shown that 3 is the minimum number of operations required to get a special number.

Example 3:

Input: num = "10"
Output: 1
Explanation: Delete digit num[0]. The resulting number is "0" which is special since it is divisible by 25.
It can be shown that 1 is the minimum number of operations required to get a special number.

Constraints:

 * 1 <= num.length <= 100
 * num only consists of digits '0' through '9'.
 * num does not contain any leading zeros.
"""
class Solution:
    def minimumOperations(self, num: str) -> int:

You are given a 0-indexed string num representing a non-negative integer.

In one operation, you can pick any digit of num and delete it. Note that if you delete all the digits of num, num becomes 0.

Return the minimum number of operations required to make num special.

An integer x is considered special if it is divisible by 25.

Example 1:

Input: num = "2245047"
Output: 2
Explanation: Delete digits num[5] and num[6]. The resulting number is "22450" which is special since it is divisible by 25.
It can be shown that 2 is the minimum number of operations required to get a special number.

Example 2:

Input: num = "2908305"
Output: 3
Explanation: Delete digits num[3], num[4], and num[6]. The resulting number is "2900" which is special since it is divisible by 25.
It can be shown that 3 is the minimum number of operations required to get a special number.

Example 3:

Input: num = "10"
Output: 1
Explanation: Delete digit num[0]. The resulting number is "0" which is special since it is divisible by 25.
It can be shown that 1 is the minimum number of operations required to get a special number.

Constraints:

 * 1 <= num.length <= 100
 * num only consists of digits '0' through '9'.
 * num does not contain any leading zeros.

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

```

my_solution = Solution()

test_input = { "num": "2245047" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "2908305" }
assert my_solution.minimumOperations(**test_input) == 3

test_input = { "num": "10" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "1" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "2" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "3" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "4" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "5" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "6" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "7" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "8" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "9" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "11" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "12" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "13" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "14" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "15" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "16" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "17" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "18" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "19" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "20" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "21" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "22" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "23" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "24" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "25" }
assert my_solution.minimumOperations(**test_input) == 0

test_input = { "num": "26" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "27" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "28" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "29" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "30" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "31" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "32" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "33" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "34" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "35" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "36" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "37" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "38" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "39" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "40" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "41" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "42" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "43" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "44" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "45" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "46" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "47" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "48" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "49" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "50" }
assert my_solution.minimumOperations(**test_input) == 0

test_input = { "num": "51" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "52" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "53" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "54" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "55" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "56" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "57" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "58" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "59" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "60" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "61" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "62" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "63" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "64" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "65" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "66" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "67" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "68" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "69" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "70" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "71" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "72" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "73" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "74" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "75" }
assert my_solution.minimumOperations(**test_input) == 0

test_input = { "num": "76" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "77" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "78" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "79" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "80" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "81" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "82" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "83" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "84" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "85" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "86" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "87" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "88" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "89" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "90" }
assert my_solution.minimumOperations(**test_input) == 1

test_input = { "num": "91" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "92" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "93" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "94" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "95" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "96" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "97" }
assert my_solution.minimumOperations(**test_input) == 2

test_input = { "num": "98" }
assert my_solution.minimumOperations(**test_input) == 2


count-of-interesting-subarrays

Count of Interesting Subarrays

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

Your task is to find the count of subarrays that are interesting.

A subarray nums[l..r] is interesting if the following condition holds:

 * Let cnt be the number of indices i in the range [l, r] such that nums[i] % modulo == k. Then, cnt % modulo == k.

Return an integer denoting the count of interesting subarrays.

Note: A subarray is a contiguous non-empty sequence of elements within an array.

Example 1:

Input: nums = [3,2,4], modulo = 2, k = 1
Output: 3
Explanation: In this example the interesting subarrays are:
The subarray nums[0..0] which is [3].
- There is only one index, i = 0, in the range [0, 0] that satisfies nums[i] % modulo == k.
- Hence, cnt = 1 and cnt % modulo == k.
The subarray nums[0..1] which is [3,2].
- There is only one index, i = 0, in the range [0, 1] that satisfies nums[i] % modulo == k.
- Hence, cnt = 1 and cnt % modulo == k.
The subarray nums[0..2] which is [3,2,4].
- There is only one index, i = 0, in the range [0, 2] that satisfies nums[i] % modulo == k.
- Hence, cnt = 1 and cnt % modulo == k.
It can be shown that there are no other interesting subarrays. So, the answer is 3.

Example 2:

Input: nums = [3,1,9,6], modulo = 3, k = 0
Output: 2
Explanation: In this example the interesting subarrays are:
The subarray nums[0..3] which is [3,1,9,6].
- There are three indices, i = 0, 2, 3, in the range [0, 3] that satisfy nums[i] % modulo == k.
- Hence, cnt = 3 and cnt % modulo == k.
The subarray nums[1..1] which is [1].
- There is no index, i, in the range [1, 1] that satisfies nums[i] % modulo == k.
- Hence, cnt = 0 and cnt % modulo == k.
It can be shown that there are no other interesting subarrays. So, the answer is 2.

Constraints:

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

You are given a 0-indexed integer array nums, an integer modulo, and an integer k.

Your task is to find the count of subarrays that are interesting.

A subarray nums[l..r] is interesting if the following condition holds:

 * Let cnt be the number of indices i in the range [l, r] such that nums[i] % modulo == k. Then, cnt % modulo == k.

Return an integer denoting the count of interesting subarrays.

Note: A subarray is a contiguous non-empty sequence of elements within an array.

Example 1:

Input: nums = [3,2,4], modulo = 2, k = 1
Output: 3
Explanation: In this example the interesting subarrays are:
The subarray nums[0..0] which is [3].
- There is only one index, i = 0, in the range [0, 0] that satisfies nums[i] % modulo == k.
- Hence, cnt = 1 and cnt % modulo == k.
The subarray nums[0..1] which is [3,2].
- There is only one index, i = 0, in the range [0, 1] that satisfies nums[i] % modulo == k.
- Hence, cnt = 1 and cnt % modulo == k.
The subarray nums[0..2] which is [3,2,4].
- There is only one index, i = 0, in the range [0, 2] that satisfies nums[i] % modulo == k.
- Hence, cnt = 1 and cnt % modulo == k.
It can be shown that there are no other interesting subarrays. So, the answer is 3.

Example 2:

Input: nums = [3,1,9,6], modulo = 3, k = 0
Output: 2
Explanation: In this example the interesting subarrays are:
The subarray nums[0..3] which is [3,1,9,6].
- There are three indices, i = 0, 2, 3, in the range [0, 3] that satisfy nums[i] % modulo == k.
- Hence, cnt = 3 and cnt % modulo == k.
The subarray nums[1..1] which is [1].
- There is no index, i, in the range [1, 1] that satisfies nums[i] % modulo == k.
- Hence, cnt = 0 and cnt % modulo == k.
It can be shown that there are no other interesting subarrays. So, the answer is 2.

Constraints:

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

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

```

my_solution = Solution()

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

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

test_input = { "nums": [11,12,21,31], "modulo": 10, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 5

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

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

test_input = { "nums": [2,45], "modulo": 13, "k": 2 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [3,3], "modulo": 5, "k": 3 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

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

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

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

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

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

test_input = { "nums": [8,8], "modulo": 4, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

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

test_input = { "nums": [18,43], "modulo": 3, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 1

test_input = { "nums": [19,67], "modulo": 47, "k": 19 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [20,8], "modulo": 41, "k": 8 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [26,5], "modulo": 21, "k": 5 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [81,36], "modulo": 4, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 1

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

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

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

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

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

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

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

test_input = { "nums": [6,5,6], "modulo": 6, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 1

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

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

test_input = { "nums": [7,5,6], "modulo": 4, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 4

test_input = { "nums": [9,1,6], "modulo": 7, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 4

test_input = { "nums": [40,1,24], "modulo": 41, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 4

test_input = { "nums": [48,36,27], "modulo": 9, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 1

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

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

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

test_input = { "nums": [4,18,38,15], "modulo": 21, "k": 4 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [6,6,1,4], "modulo": 7, "k": 6 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

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

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

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

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

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

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

test_input = { "nums": [9,7,8,9], "modulo": 5, "k": 4 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [9,48,32,11], "modulo": 2, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 6

test_input = { "nums": [53,44,40,37], "modulo": 2, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 6

test_input = { "nums": [91,5,60,93], "modulo": 59, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 6

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

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

test_input = { "nums": [2,2,5,6,1], "modulo": 1, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 15

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

test_input = { "nums": [2,7,4,8,5], "modulo": 2, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 7

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

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

test_input = { "nums": [5,6,3,9,3], "modulo": 9, "k": 3 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [6,7,1,9,2], "modulo": 1, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 15

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

test_input = { "nums": [7,3,6,2,6], "modulo": 1, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 15

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

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

test_input = { "nums": [8,6,9,4,4], "modulo": 9, "k": 4 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [8,8,6,8,9], "modulo": 9, "k": 8 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [9,7,8,7,8], "modulo": 7, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 3

test_input = { "nums": [26,9,14,4,24], "modulo": 26, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 10

test_input = { "nums": [31,30,24,34,20], "modulo": 22, "k": 2 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [39,41,6,30,38], "modulo": 43, "k": 6 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

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

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

test_input = { "nums": [1,7,8,2,5,9], "modulo": 7, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 10

test_input = { "nums": [2,4,6,6,5,1], "modulo": 8, "k": 6 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

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

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

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

test_input = { "nums": [2,9,6,8,8,3], "modulo": 1, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 21

test_input = { "nums": [4,8,4,3,7,5], "modulo": 4, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 6

test_input = { "nums": [4,9,4,9,7,7], "modulo": 9, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 5

test_input = { "nums": [5,3,7,9,8,7], "modulo": 3, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 5

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

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

test_input = { "nums": [7,4,9,8,3,4], "modulo": 1, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 21

test_input = { "nums": [7,5,1,7,7,7], "modulo": 8, "k": 7 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [8,4,5,6,7,4], "modulo": 4, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 6

test_input = { "nums": [8,7,3,8,4,8], "modulo": 8, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 4

test_input = { "nums": [8,7,5,5,2,1], "modulo": 5, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 6

test_input = { "nums": [8,18,36,50,12,37], "modulo": 18, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 7

test_input = { "nums": [9,9,6,7,2,3], "modulo": 5, "k": 2 }
assert my_solution.countInterestingSubarrays(**test_input) == 8

test_input = { "nums": [16,1,33,39,15,1], "modulo": 30, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 12

test_input = { "nums": [17,25,9,20,41,26], "modulo": 38, "k": 3 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [21,26,39,21,31,49], "modulo": 22, "k": 21 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [37,44,17,22,50,15], "modulo": 6, "k": 2 }
assert my_solution.countInterestingSubarrays(**test_input) == 4

test_input = { "nums": [40,10,31,40,30,32], "modulo": 50, "k": 40 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [40,22,22,35,2,16], "modulo": 24, "k": 16 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [98,23,66,13,70,34], "modulo": 74, "k": 13 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

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

test_input = { "nums": [1,8,6,3,2,8,8], "modulo": 2, "k": 0 }
assert my_solution.countInterestingSubarrays(**test_input) == 13

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

test_input = { "nums": [4,6,8,3,4,3,4], "modulo": 7, "k": 4 }
assert my_solution.countInterestingSubarrays(**test_input) == 0

test_input = { "nums": [5,4,5,8,9,1,9], "modulo": 4, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 11

test_input = { "nums": [5,4,6,1,3,2,7], "modulo": 9, "k": 1 }
assert my_solution.countInterestingSubarrays(**test_input) == 16


minimum-edge-weight-equilibrium-queries-in-a-tree

Minimum Edge Weight Equilibrium Queries in a Tree

Prompt:
"""
There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i] = [ui, vi, wi] indicates that there is an edge between nodes ui and vi with weight wi in the tree.

You are also given a 2D integer array queries of length m, where queries[i] = [ai, bi]. For each query, find the minimum number of operations required to make the weight of every edge on the path from ai to bi equal. In one operation, you can choose any edge of the tree and change its weight to any value.

Note that:

 * Queries are independent of each other, meaning that the tree returns to its initial state on each new query.
 * The path from ai to bi is a sequence of distinct nodes starting with node ai and ending with node bi such that every two adjacent nodes in the sequence share an edge in the tree.

Return an array answer of length m where answer[i] is the answer to the ith query.

Example 1:

[https://assets.leetcode.com/uploads/2023/08/11/graph-6-1.png]

Input: n = 7, edges = [[0,1,1],[1,2,1],[2,3,1],[3,4,2],[4,5,2],[5,6,2]], queries = [[0,3],[3,6],[2,6],[0,6]]
Output: [0,0,1,3]
Explanation: In the first query, all the edges in the path from 0 to 3 have a weight of 1. Hence, the answer is 0.
In the second query, all the edges in the path from 3 to 6 have a weight of 2. Hence, the answer is 0.
In the third query, we change the weight of edge [2,3] to 2. After this operation, all the edges in the path from 2 to 6 have a weight of 2. Hence, the answer is 1.
In the fourth query, we change the weights of edges [0,1], [1,2] and [2,3] to 2. After these operations, all the edges in the path from 0 to 6 have a weight of 2. Hence, the answer is 3.
For each queries[i], it can be shown that answer[i] is the minimum number of operations needed to equalize all the edge weights in the path from ai to bi.

Example 2:

[https://assets.leetcode.com/uploads/2023/08/11/graph-9-1.png]

Input: n = 8, edges = [[1,2,6],[1,3,4],[2,4,6],[2,5,3],[3,6,6],[3,0,8],[7,0,2]], queries = [[4,6],[0,4],[6,5],[7,4]]
Output: [1,2,2,3]
Explanation: In the first query, we change the weight of edge [1,3] to 6. After this operation, all the edges in the path from 4 to 6 have a weight of 6. Hence, the answer is 1.
In the second query, we change the weight of edges [0,3] and [3,1] to 6. After these operations, all the edges in the path from 0 to 4 have a weight of 6. Hence, the answer is 2.
In the third query, we change the weight of edges [1,3] and [5,2] to 6. After these operations, all the edges in the path from 6 to 5 have a weight of 6. Hence, the answer is 2.
In the fourth query, we change the weights of edges [0,7], [0,3] and [1,3] to 6. After these operations, all the edges in the path from 7 to 4 have a weight of 6. Hence, the answer is 3.
For each queries[i], it can be shown that answer[i] is the minimum number of operations needed to equalize all the edge weights in the path from ai to bi.

Constraints:

 * 1 <= n <= 104
 * edges.length == n - 1
 * edges[i].length == 3
 * 0 <= ui, vi < n
 * 1 <= wi <= 26
 * The input is generated such that edges represents a valid tree.
 * 1 <= queries.length == m <= 2 * 104
 * queries[i].length == 2
 * 0 <= ai, bi < n
"""
class Solution:
    def minOperationsQueries(self, n: int, edges: List[List[int]], queries: List[List[int]]) -> List[int]:

There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i] = [ui, vi, wi] indicates that there is an edge between nodes ui and vi with weight wi in the tree.

You are also given a 2D integer array queries of length m, where queries[i] = [ai, bi]. For each query, find the minimum number of operations required to make the weight of every edge on the path from ai to bi equal. In one operation, you can choose any edge of the tree and change its weight to any value.

Note that:

 * Queries are independent of each other, meaning that the tree returns to its initial state on each new query.
 * The path from ai to bi is a sequence of distinct nodes starting with node ai and ending with node bi such that every two adjacent nodes in the sequence share an edge in the tree.

Return an array answer of length m where answer[i] is the answer to the ith query.

Example 1:

[https://assets.leetcode.com/uploads/2023/08/11/graph-6-1.png]

Input: n = 7, edges = [[0,1,1],[1,2,1],[2,3,1],[3,4,2],[4,5,2],[5,6,2]], queries = [[0,3],[3,6],[2,6],[0,6]]
Output: [0,0,1,3]
Explanation: In the first query, all the edges in the path from 0 to 3 have a weight of 1. Hence, the answer is 0.
In the second query, all the edges in the path from 3 to 6 have a weight of 2. Hence, the answer is 0.
In the third query, we change the weight of edge [2,3] to 2. After this operation, all the edges in the path from 2 to 6 have a weight of 2. Hence, the answer is 1.
In the fourth query, we change the weights of edges [0,1], [1,2] and [2,3] to 2. After these operations, all the edges in the path from 0 to 6 have a weight of 2. Hence, the answer is 3.
For each queries[i], it can be shown that answer[i] is the minimum number of operations needed to equalize all the edge weights in the path from ai to bi.

Example 2:

[https://assets.leetcode.com/uploads/2023/08/11/graph-9-1.png]

Input: n = 8, edges = [[1,2,6],[1,3,4],[2,4,6],[2,5,3],[3,6,6],[3,0,8],[7,0,2]], queries = [[4,6],[0,4],[6,5],[7,4]]
Output: [1,2,2,3]
Explanation: In the first query, we change the weight of edge [1,3] to 6. After this operation, all the edges in the path from 4 to 6 have a weight of 6. Hence, the answer is 1.
In the second query, we change the weight of edges [0,3] and [3,1] to 6. After these operations, all the edges in the path from 0 to 4 have a weight of 6. Hence, the answer is 2.
In the third query, we change the weight of edges [1,3] and [5,2] to 6. After these operations, all the edges in the path from 6 to 5 have a weight of 6. Hence, the answer is 2.
In the fourth query, we change the weights of edges [0,7], [0,3] and [1,3] to 6. After these operations, all the edges in the path from 7 to 4 have a weight of 6. Hence, the answer is 3.
For each queries[i], it can be shown that answer[i] is the minimum number of operations needed to equalize all the edge weights in the path from ai to bi.

Constraints:

 * 1 <= n <= 104
 * edges.length == n - 1
 * edges[i].length == 3
 * 0 <= ui, vi < n
 * 1 <= wi <= 26
 * The input is generated such that edges represents a valid tree.
 * 1 <= queries.length == m <= 2 * 104
 * queries[i].length == 2
 * 0 <= ai, bi < n

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

```


check-if-strings-can-be-made-equal-with-operations-i

Check if Strings Can be Made Equal With Operations I

Prompt:
"""
You are given two strings s1 and s2, both of length 4, consisting of lowercase English letters.

You can apply the following operation on any of the two strings any number of times:

 * Choose any two indices i and j such that j - i = 2, then swap the two characters at those indices in the string.

Return true if you can make the strings s1 and s2 equal, and false otherwise.

Example 1:

Input: s1 = "abcd", s2 = "cdab"
Output: true
Explanation: We can do the following operations on s1:
- Choose the indices i = 0, j = 2. The resulting string is s1 = "cbad".
- Choose the indices i = 1, j = 3. The resulting string is s1 = "cdab" = s2.

Example 2:

Input: s1 = "abcd", s2 = "dacb"
Output: false
Explanation: It is not possible to make the two strings equal.

Constraints:

 * s1.length == s2.length == 4
 * s1 and s2 consist only of lowercase English letters.
"""
class Solution:
    def canBeEqual(self, s1: str, s2: str) -> bool:

You are given two strings s1 and s2, both of length 4, consisting of lowercase English letters.

You can apply the following operation on any of the two strings any number of times:

 * Choose any two indices i and j such that j - i = 2, then swap the two characters at those indices in the string.

Return true if you can make the strings s1 and s2 equal, and false otherwise.

Example 1:

Input: s1 = "abcd", s2 = "cdab"
Output: true
Explanation: We can do the following operations on s1:
- Choose the indices i = 0, j = 2. The resulting string is s1 = "cbad".
- Choose the indices i = 1, j = 3. The resulting string is s1 = "cdab" = s2.

Example 2:

Input: s1 = "abcd", s2 = "dacb"
Output: false
Explanation: It is not possible to make the two strings equal.

Constraints:

 * s1.length == s2.length == 4
 * s1 and s2 consist only of lowercase English letters.

Please complete the code below to solve above prblem:
```python
class Solution:
    def canBeEqual(self, s1: str, s2: str) -> bool:

```

my_solution = Solution()

test_input = { "s1": "abcd", "s2": "cdab" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "abcd", "s2": "dacb" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "gudo", "s2": "ogdu" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "bnxw", "s2": "bwxn" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "zzon", "s2": "zozn" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "cmpr", "s2": "rmcp" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "qnde", "s2": "flsi" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "vofo", "s2": "oofv" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "xsvc", "s2": "vcxs" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "hvsz", "s2": "hzsv" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "ifjz", "s2": "jzfi" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "zrmq", "s2": "mrzq" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "hazw", "s2": "pfmp" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "kina", "s2": "kina" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "fymg", "s2": "famj" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "riti", "s2": "riti" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "goze", "s2": "gezo" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "seeo", "s2": "vfvm" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "ybyd", "s2": "himj" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "gcdm", "s2": "dmgc" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "kvne", "s2": "nekv" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "cbyo", "s2": "cbyo" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "fezu", "s2": "zufe" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "homs", "s2": "fhdu" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "zlek", "s2": "zlek" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "bxqt", "s2": "xbtq" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "waso", "s2": "wyjd" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "nibi", "s2": "seua" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "oynw", "s2": "sgxl" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "ehui", "s2": "uhei" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "vchn", "s2": "jfwr" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "zgmt", "s2": "zgmt" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "eobz", "s2": "boez" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "zpzg", "s2": "zzpg" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "bbfp", "s2": "fbbp" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "vxqp", "s2": "xpvq" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "ihtv", "s2": "ixji" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "ahsk", "s2": "aksh" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "zexw", "s2": "miva" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "iicq", "s2": "ihda" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "kunv", "s2": "ziac" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "gqzd", "s2": "gqzd" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "ppeb", "s2": "ebpp" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "uouc", "s2": "ucuo" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "laxa", "s2": "xala" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "rbwe", "s2": "wbre" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "mswt", "s2": "wsmt" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "yfyz", "s2": "deyv" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "jlai", "s2": "alji" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "uliu", "s2": "bsmu" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "bhag", "s2": "kuws" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "bvwr", "s2": "wrbv" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "safs", "s2": "safs" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "hzfp", "s2": "hpfz" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "xide", "s2": "dixe" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "qpye", "s2": "qpye" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "zaus", "s2": "zsua" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "lpsc", "s2": "cslp" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "taxc", "s2": "taxc" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "kkjc", "s2": "kcjk" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "pshr", "s2": "prhs" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "kpdr", "s2": "djoe" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "vzla", "s2": "lzva" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "tcar", "s2": "tacr" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "zkyt", "s2": "yfzr" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "puwg", "s2": "pgwu" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "ownv", "s2": "ovnw" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "rayz", "s2": "bpnf" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "zbwg", "s2": "wbzg" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "rypk", "s2": "pyrk" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "qchw", "s2": "bcqn" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "qtpf", "s2": "qfpt" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "apnl", "s2": "nlap" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "pkmh", "s2": "mkph" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "ouxw", "s2": "xuow" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "dlgd", "s2": "gdld" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "xbcx", "s2": "cxxb" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "eaba", "s2": "uaul" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "fyro", "s2": "rofy" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "bzqb", "s2": "bzqb" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "zyjv", "s2": "xjzr" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "jdvv", "s2": "djvv" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "nyxb", "s2": "ocry" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "gxlx", "s2": "lxgx" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "kgkr", "s2": "krkg" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "edfw", "s2": "fdew" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "vxkq", "s2": "kqxv" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "qnjc", "s2": "jivc" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "zzaf", "s2": "azzf" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "esgr", "s2": "gres" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "meuu", "s2": "yqlh" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "gjda", "s2": "djga" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "qaqz", "s2": "qaqz" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "legy", "s2": "lyge" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "eeum", "s2": "emue" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "vsvs", "s2": "vsvs" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "mxlk", "s2": "mxlk" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "nbre", "s2": "renb" }
assert my_solution.canBeEqual(**test_input) == True

test_input = { "s1": "erfk", "s2": "gmfy" }
assert my_solution.canBeEqual(**test_input) == False

test_input = { "s1": "gsic", "s2": "snvs" }
assert my_solution.canBeEqual(**test_input) == False


check-if-strings-can-be-made-equal-with-operations-ii

Check if Strings Can be Made Equal With Operations II

Prompt:
"""
You are given two strings s1 and s2, both of length n, consisting of lowercase English letters.

You can apply the following operation on any of the two strings any number of times:

 * Choose any two indices i and j such that i < j and the difference j - i is even, then swap the two characters at those indices in the string.

Return true if you can make the strings s1 and s2 equal, and false otherwise.

Example 1:

Input: s1 = "abcdba", s2 = "cabdab"
Output: true
Explanation: We can apply the following operations on s1:
- Choose the indices i = 0, j = 2. The resulting string is s1 = "cbadba".
- Choose the indices i = 2, j = 4. The resulting string is s1 = "cbbdaa".
- Choose the indices i = 1, j = 5. The resulting string is s1 = "cabdab" = s2.

Example 2:

Input: s1 = "abe", s2 = "bea"
Output: false
Explanation: It is not possible to make the two strings equal.

Constraints:

 * n == s1.length == s2.length
 * 1 <= n <= 105
 * s1 and s2 consist only of lowercase English letters.
"""
class Solution:
    def checkStrings(self, s1: str, s2: str) -> bool:

You are given two strings s1 and s2, both of length n, consisting of lowercase English letters.

You can apply the following operation on any of the two strings any number of times:

 * Choose any two indices i and j such that i < j and the difference j - i is even, then swap the two characters at those indices in the string.

Return true if you can make the strings s1 and s2 equal, and false otherwise.

Example 1:

Input: s1 = "abcdba", s2 = "cabdab"
Output: true
Explanation: We can apply the following operations on s1:
- Choose the indices i = 0, j = 2. The resulting string is s1 = "cbadba".
- Choose the indices i = 2, j = 4. The resulting string is s1 = "cbbdaa".
- Choose the indices i = 1, j = 5. The resulting string is s1 = "cabdab" = s2.

Example 2:

Input: s1 = "abe", s2 = "bea"
Output: false
Explanation: It is not possible to make the two strings equal.

Constraints:

 * n == s1.length == s2.length
 * 1 <= n <= 105
 * s1 and s2 consist only of lowercase English letters.

Please complete the code below to solve above prblem:
```python
class Solution:
    def checkStrings(self, s1: str, s2: str) -> bool:

```

my_solution = Solution()

test_input = { "s1": "abe", "s2": "bea" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "abcdba", "s2": "cabdab" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ublnlasppynwgx", "s2": "ganplbuylnswpx" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "jghn", "s2": "jghn" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "pqtsprqmvi", "s2": "qrvqpitmps" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "aavizsxpqhxztrwi", "s2": "zvisqatzpaxhixwr" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "slmqqdbrwyvm", "s2": "qyldmmwsrqvb" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "shvqocguj", "s2": "vqsghujco" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "ktjpralqanofuuqsyal", "s2": "qjlornpasktfuyluaqa" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "mgflranpdjdkrh", "s2": "fpcgobmkdxbzyl" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "usvpwcehhvlg", "s2": "ehuvvshcwplg" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "jh", "s2": "fy" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "kfqofkvsoiiirznw", "s2": "hosthwbinxrsikkf" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "ppmfd", "s2": "pfdpm" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ntuuwwh", "s2": "jyjwmdf" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "lcgcm", "s2": "brdxe" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "hjswnccgwjcapko", "s2": "acwjnjoscchgwpk" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "epjtzubboiallzd", "s2": "dboilpzzjteualb" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "c", "s2": "c" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "oziiqbotydegrm", "s2": "ytizriobogqmed" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ztmuzn", "s2": "muztzn" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "jkzcqlh", "s2": "hkqczlj" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "qnh", "s2": "cmq" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "azagmtvhske", "s2": "mkazstvhage" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "jitb", "s2": "zqbg" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "tgznpamgczyvqjzvp", "s2": "mpyzvzzjvaqntgpgc" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "tcl", "s2": "lct" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "datuhdkoqe", "s2": "hetddokuqa" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ztnpdilyrxz", "s2": "yxzitnrdlzp" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "vx", "s2": "zv" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "tpfcyceq", "s2": "fceqtpyc" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "rcugebinbszkhy", "s2": "zkebryhcbginus" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ryykp", "s2": "rkpyy" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "lpyfmysemgoxgawwr", "s2": "wfoyspygralemxgwm" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "bfylavpyffcnj", "s2": "cljfbfyvpnayf" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "chhbmikpp", "s2": "hpcimbkhp" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "nateujd", "s2": "jeutnad" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "sxrjofoedghtplnex", "s2": "sgdeolnepthfojrxx" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ajvfujrczdciilihi", "s2": "jcriaviuiflicdhzj" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "gajpuahzcexdunltldh", "s2": "xxatubgvqzmxjvzcxah" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "hnisnfvikgrhkfoe", "s2": "hgkivsifrekfonnh" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "fvfsxftpuemgpnkzz", "s2": "mgknxpuztffvzepsf" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "zrwzpibwp", "s2": "pwpiwzbrz" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "zoqpcssnhugxffcptsj", "s2": "chgospjssfxnfpcuqzt" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "ldpjhj", "s2": "jdlpjh" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "zodbh", "s2": "pqdpy" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "mdcvitezgqur", "s2": "mvigcqrdeztu" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "rdyau", "s2": "dyrau" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "pyymcw", "s2": "ptlqxp" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "ebicv", "s2": "vibce" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "xkzknvrbvajwbj", "s2": "rnkwzbvvxkjbja" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "zoxpiqxvnk", "s2": "xvkpxinqoz" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "obhmqltgmoszljeyh", "s2": "ogmmlbhoeysjtlhzq" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "wfsdirrheuglhfkbjk", "s2": "wfsuhhglifkrebrdjk" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "shn", "s2": "hsn" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "xdicugry", "s2": "igucxdry" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "bkfmkrbybim", "s2": "brbimkkmbyf" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "dwowyfgreakdvfi", "s2": "yfiddfvwerkaowg" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "bdywnvbgmum", "s2": "guymbwdbnmv" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "tmujoqerfvupnyy", "s2": "uvortyfmuqypnje" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "hggckwudke", "s2": "ylkgulkehd" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "zrppcm", "s2": "okurkg" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "ennl", "s2": "ennl" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "spznlxodciidngyvvkl", "s2": "lnvnzdixivoglydscpk" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "nxezcoklmdbekyjp", "s2": "cdkenlkyeomxjzbp" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "yui", "s2": "iyu" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "zphe", "s2": "hpze" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "oyjngnej", "s2": "oynjjeng" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "kvwdssgl", "s2": "wskxsdgv" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "ozzfbhzkowpcv", "s2": "vzpwzkbhzfoco" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "h", "s2": "h" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "mqkdv", "s2": "kqvdm" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "hphfqesitgprud", "s2": "tpisuhqhfgdrpe" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "yrbto", "s2": "orytb" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "lvahby", "s2": "ilbyaz" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "bbaiabphflgyfo", "s2": "bhglybaoaipbff" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "uielps", "s2": "uselpi" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ftyhgkgwg", "s2": "gtfhgwgky" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "mzrfxrwlliuoi", "s2": "llrouzirwimfx" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "drofbzocwolcznzfi", "s2": "wzocdnirzfbclozfo" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "popefwbkepdxy", "s2": "pxbwpeekfoypd" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "swgzqluzcvhskegvdry", "s2": "seuwkvclqzyvdsgrgzh" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "hik", "s2": "ihk" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "zq", "s2": "zq" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "igdzd", "s2": "phcyi" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "cazutcxkhcklpuogt", "s2": "ockghuukctcztxapl" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "bx", "s2": "bx" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "bkujvjwgjzxdzuw", "s2": "zgjubjwkwzxdujv" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ujpudt", "s2": "dtujpu" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "hkalpd", "s2": "hlpkad" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "kbcpjzadbv", "s2": "dsgzcapzao" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "rubbbf", "s2": "rbbubf" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "ybudbyrlmiddsxks", "s2": "nuyyabyisyptvdnb" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "wiijtcgqez", "s2": "ctqzwjgiei" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "bgalfvefwmhodexazkd", "s2": "fbgmdfholzakvxaweed" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "oxlphorosradotpshnt", "s2": "hdotpaoorosrlhtsxpn" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "mnvnzakjaymsxhojq", "s2": "oaxjoeanksmyqmglm" }
assert my_solution.checkStrings(**test_input) == False

test_input = { "s1": "hsm", "s2": "hsm" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "qgloiyhewunm", "s2": "qehuwonmiylg" }
assert my_solution.checkStrings(**test_input) == True

test_input = { "s1": "drdu", "s2": "dudr" }
assert my_solution.checkStrings(**test_input) == True


maximum-sum-of-almost-unique-subarray

Maximum Sum of Almost Unique Subarray

Prompt:
"""
You are given an integer array nums and two positive integers m and k.

Return the maximum sum out of all almost unique subarrays of length k of nums. If no such subarray exists, return 0.

A subarray of nums is almost unique if it contains at least m distinct elements.

A subarray is a contiguous non-empty sequence of elements within an array.

Example 1:

Input: nums = [2,6,7,3,1,7], m = 3, k = 4
Output: 18
Explanation: There are 3 almost unique subarrays of size k = 4. These subarrays are [2, 6, 7, 3], [6, 7, 3, 1], and [7, 3, 1, 7]. Among these subarrays, the one with the maximum sum is [2, 6, 7, 3] which has a sum of 18.

Example 2:

Input: nums = [5,9,9,2,4,5,4], m = 1, k = 3
Output: 23
Explanation: There are 5 almost unique subarrays of size k. These subarrays are [5, 9, 9], [9, 9, 2], [9, 2, 4], [2, 4, 5], and [4, 5, 4]. Among these subarrays, the one with the maximum sum is [5, 9, 9] which has a sum of 23.

Example 3:

Input: nums = [1,2,1,2,1,2,1], m = 3, k = 3
Output: 0
Explanation: There are no subarrays of size k = 3 that contain at least m = 3 distinct elements in the given array [1,2,1,2,1,2,1]. Therefore, no almost unique subarrays exist, and the maximum sum is 0.

Constraints:

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

You are given an integer array nums and two positive integers m and k.

Return the maximum sum out of all almost unique subarrays of length k of nums. If no such subarray exists, return 0.

A subarray of nums is almost unique if it contains at least m distinct elements.

A subarray is a contiguous non-empty sequence of elements within an array.

Example 1:

Input: nums = [2,6,7,3,1,7], m = 3, k = 4
Output: 18
Explanation: There are 3 almost unique subarrays of size k = 4. These subarrays are [2, 6, 7, 3], [6, 7, 3, 1], and [7, 3, 1, 7]. Among these subarrays, the one with the maximum sum is [2, 6, 7, 3] which has a sum of 18.

Example 2:

Input: nums = [5,9,9,2,4,5,4], m = 1, k = 3
Output: 23
Explanation: There are 5 almost unique subarrays of size k. These subarrays are [5, 9, 9], [9, 9, 2], [9, 2, 4], [2, 4, 5], and [4, 5, 4]. Among these subarrays, the one with the maximum sum is [5, 9, 9] which has a sum of 23.

Example 3:

Input: nums = [1,2,1,2,1,2,1], m = 3, k = 3
Output: 0
Explanation: There are no subarrays of size k = 3 that contain at least m = 3 distinct elements in the given array [1,2,1,2,1,2,1]. Therefore, no almost unique subarrays exist, and the maximum sum is 0.

Constraints:

 * 1 <= nums.length <= 2 * 104
 * 1 <= m <= k <= nums.length
 * 1 <= nums[i] <= 109

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


count-k-subsequences-of-a-string-with-maximum-beauty

Count K-Subsequences of a String With Maximum Beauty

Prompt:
"""
You are given a string s and an integer k.

A k-subsequence is a subsequence of s, having length k, and all its characters are unique, i.e., every character occurs once.

Let f(c) denote the number of times the character c occurs in s.

The beauty of a k-subsequence is the sum of f(c) for every character c in the k-subsequence.

For example, consider s = "abbbdd" and k = 2:

 * f('a') = 1, f('b') = 3, f('d') = 2
 * Some k-subsequences of s are:
   * "abbbdd" -> "ab" having a beauty of f('a') + f('b') = 4
   * "abbbdd" -> "ad" having a beauty of f('a') + f('d') = 3
   * "abbbdd" -> "bd" having a beauty of f('b') + f('d') = 5

Return an integer denoting the number of k-subsequences whose beauty is the maximum among all k-subsequences. Since the answer may be too large, return it modulo 109 + 7.

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

Notes

 * f(c) is the number of times a character c occurs in s, not a k-subsequence.
 * Two k-subsequences are considered different if one is formed by an index that is not present in the other. So, two k-subsequences may form the same string.

Example 1:

Input: s = "bcca", k = 2
Output: 4
Explanation: From s we have f('a') = 1, f('b') = 1, and f('c') = 2.
The k-subsequences of s are:
bcca having a beauty of f('b') + f('c') = 3
bcca having a beauty of f('b') + f('c') = 3
bcca having a beauty of f('b') + f('a') = 2
bcca having a beauty of f('c') + f('a') = 3
bcca having a beauty of f('c') + f('a') = 3
There are 4 k-subsequences that have the maximum beauty, 3.
Hence, the answer is 4.

Example 2:

Input: s = "abbcd", k = 4
Output: 2
Explanation: From s we have f('a') = 1, f('b') = 2, f('c') = 1, and f('d') = 1.
The k-subsequences of s are:
abbcd having a beauty of f('a') + f('b') + f('c') + f('d') = 5
abbcd having a beauty of f('a') + f('b') + f('c') + f('d') = 5
There are 2 k-subsequences that have the maximum beauty, 5.
Hence, the answer is 2.

Constraints:

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

You are given a string s and an integer k.

A k-subsequence is a subsequence of s, having length k, and all its characters are unique, i.e., every character occurs once.

Let f(c) denote the number of times the character c occurs in s.

The beauty of a k-subsequence is the sum of f(c) for every character c in the k-subsequence.

For example, consider s = "abbbdd" and k = 2:

 * f('a') = 1, f('b') = 3, f('d') = 2
 * Some k-subsequences of s are:
   * "abbbdd" -> "ab" having a beauty of f('a') + f('b') = 4
   * "abbbdd" -> "ad" having a beauty of f('a') + f('d') = 3
   * "abbbdd" -> "bd" having a beauty of f('b') + f('d') = 5

Return an integer denoting the number of k-subsequences whose beauty is the maximum among all k-subsequences. Since the answer may be too large, return it modulo 109 + 7.

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

Notes

 * f(c) is the number of times a character c occurs in s, not a k-subsequence.
 * Two k-subsequences are considered different if one is formed by an index that is not present in the other. So, two k-subsequences may form the same string.

Example 1:

Input: s = "bcca", k = 2
Output: 4
Explanation: From s we have f('a') = 1, f('b') = 1, and f('c') = 2.
The k-subsequences of s are:
bcca having a beauty of f('b') + f('c') = 3
bcca having a beauty of f('b') + f('c') = 3
bcca having a beauty of f('b') + f('a') = 2
bcca having a beauty of f('c') + f('a') = 3
bcca having a beauty of f('c') + f('a') = 3
There are 4 k-subsequences that have the maximum beauty, 3.
Hence, the answer is 4.

Example 2:

Input: s = "abbcd", k = 4
Output: 2
Explanation: From s we have f('a') = 1, f('b') = 2, f('c') = 1, and f('d') = 1.
The k-subsequences of s are:
abbcd having a beauty of f('a') + f('b') + f('c') + f('d') = 5
abbcd having a beauty of f('a') + f('b') + f('c') + f('d') = 5
There are 2 k-subsequences that have the maximum beauty, 5.
Hence, the answer is 2.

Constraints:

 * 1 <= s.length <= 2 * 105
 * 1 <= k <= s.length
 * s consists only of lowercase English letters.

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

```

my_solution = Solution()

test_input = { "s": "bcca", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 4

test_input = { "s": "abbcd", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "am", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "az", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "ci", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "dd", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 0

test_input = { "s": "di", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "dw", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "ef", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "gq", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "hj", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "hx", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "ii", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 0

test_input = { "s": "il", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "jb", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "kx", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "qh", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "qk", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "qr", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "rg", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "rn", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "st", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "tb", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "tl", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "xc", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "auy", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "axm", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "dqc", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "fkp", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "fmk", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "fvl", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "hcx", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "iua", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "kzb", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "mhb", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "nzo", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "oof", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 0

test_input = { "s": "rfh", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "sty", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "sue", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "tba", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "tmc", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "wes", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "wvl", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "xho", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "xke", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "ysu", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "yxn", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "zco", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "zpq", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "axgn", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "dfyq", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "dogq", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "drbs", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "elex", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 0

test_input = { "s": "fsaj", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 4

test_input = { "s": "fxau", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "glbq", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "hzcj", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "minc", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 4

test_input = { "s": "nkim", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 4

test_input = { "s": "otpl", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "pvrz", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "qwmy", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "rliu", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "tpig", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "ucvh", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "vevt", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 4

test_input = { "s": "xstt", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "ypmv", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 4

test_input = { "s": "znoq", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 4

test_input = { "s": "bicnt", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "bnhom", "k": 5 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "culhr", "k": 5 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 1

test_input = { "s": "dpfki", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "dscbu", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 10

test_input = { "s": "edwlo", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 10

test_input = { "s": "ggsgo", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "guzzf", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "gzzzl", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 3

test_input = { "s": "kjojr", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "kvsds", "k": 5 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 0

test_input = { "s": "ljdvp", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "mdccc", "k": 5 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 0

test_input = { "s": "mmqny", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "mrbrj", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "pwtbx", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "qcxkr", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 10

test_input = { "s": "qvauy", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "tzwoq", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 10

test_input = { "s": "ufxge", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "unzxd", "k": 4 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "vhqqj", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 6

test_input = { "s": "vnkbt", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "wpbkz", "k": 2 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 10

test_input = { "s": "xdgvy", "k": 1 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 5

test_input = { "s": "yelem", "k": 5 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 0

test_input = { "s": "zwkhq", "k": 3 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 10

test_input = { "s": "anxnfi", "k": 5 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2

test_input = { "s": "cfbyuf", "k": 5 }
assert my_solution.countKSubsequencesWithMaxBeauty(**test_input) == 2