length-of-the-longest-subsequence-that-sums-to-target

Length of the Longest Subsequence That Sums to Target

Prompt:
"""
You are given a 0-indexed array of integers nums, and an integer target.

Return the length of the longest subsequence of nums that sums up to target. If no such subsequence exists, return -1.

A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.

Example 1:

Input: nums = [1,2,3,4,5], target = 9
Output: 3
Explanation: There are 3 subsequences with a sum equal to 9: [4,5], [1,3,5], and [2,3,4]. The longest subsequences are [1,3,5], and [2,3,4]. Hence, the answer is 3.

Example 2:

Input: nums = [4,1,3,2,1,5], target = 7
Output: 4
Explanation: There are 5 subsequences with a sum equal to 7: [4,3], [4,1,2], [4,2,1], [1,1,5], and [1,3,2,1]. The longest subsequence is [1,3,2,1]. Hence, the answer is 4.

Example 3:

Input: nums = [1,1,5,4,5], target = 3
Output: -1
Explanation: It can be shown that nums has no subsequence that sums up to 3.

Constraints:

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

You are given a 0-indexed array of integers nums, and an integer target.

Return the length of the longest subsequence of nums that sums up to target. If no such subsequence exists, return -1.

A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.

Example 1:

Input: nums = [1,2,3,4,5], target = 9
Output: 3
Explanation: There are 3 subsequences with a sum equal to 9: [4,5], [1,3,5], and [2,3,4]. The longest subsequences are [1,3,5], and [2,3,4]. Hence, the answer is 3.

Example 2:

Input: nums = [4,1,3,2,1,5], target = 7
Output: 4
Explanation: There are 5 subsequences with a sum equal to 7: [4,3], [4,1,2], [4,2,1], [1,1,5], and [1,3,2,1]. The longest subsequence is [1,3,2,1]. Hence, the answer is 4.

Example 3:

Input: nums = [1,1,5,4,5], target = 3
Output: -1
Explanation: It can be shown that nums has no subsequence that sums up to 3.

Constraints:

 * 1 <= nums.length <= 1000
 * 1 <= nums[i] <= 1000
 * 1 <= target <= 1000

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

```

my_solution = Solution()

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

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

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

test_input = { "nums": [1000], "target": 12 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == -1

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [9,12,8,4,11,13,15,7,5], "target": 84 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [11,5,9,11,12,13,12,5,1,8], "target": 87 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [9,11,11,15,4,14,3,2,13,7], "target": 89 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [11,13,6,13,10], "target": 53 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [10,3,5,11,6,12], "target": 47 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [13,3,6,6,6,15,4], "target": 53 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [1,6,15,6,14,13,14], "target": 69 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [10,7,8,14,15], "target": 54 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [14,15,8,10,8,7], "target": 62 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [7,9,14,14,9,14,5,12,10], "target": 94 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [1,10,6,14,5,13,3,7,10,10], "target": 79 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [5,2,8,6,7,12,13,4,1], "target": 58 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [12,8,2,4,1], "target": 27 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [10,14,11,13,2,11], "target": 61 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [10,2,13,5,7,15], "target": 52 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [3,1,10,1,10,1,2,9,5,13], "target": 55 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [5,13,2,13,9,4,5,7], "target": 58 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [1,15,5,12,13,10,14,8], "target": 78 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [7,4,14,10,13], "target": 48 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [6,14,14,6,2,9,1,4,10], "target": 66 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [14,15,7,5,7,10,6,14,10,11], "target": 99 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [15,13,8,8,6], "target": 50 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [2,6,8,9,13,3], "target": 41 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [13,15,9,3,8,1,9,2,15,5], "target": 80 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [5,13,9,11,6,1], "target": 45 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [7,10,15,7,14,2], "target": 55 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [12,14,13,13,13], "target": 65 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

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

test_input = { "nums": [11,1,14,13,14,4,14,11], "target": 82 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [5,9,11,2,5,2,7,11,5,3], "target": 60 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [5,15,3,13,14,15,10], "target": 75 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

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

test_input = { "nums": [7,15,4,3,9,15,12,1,12], "target": 78 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [3,1,12,15,5,10], "target": 46 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [5,3,12,7,5,2,12,10,12,5], "target": 73 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [6,10,3,1,7,11,9,8,13,12], "target": 80 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [11,3,4,11,9], "target": 38 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [15,12,12,13,6,6,4,1], "target": 69 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [9,2,10,7,10,11,14,11,8], "target": 82 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [4,4,3,9,6,8,4,7,7], "target": 52 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [10,14,4,15,9,5], "target": 57 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [4,13,2,3,13,11,8,6], "target": 60 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [1,7,8,14,15,9,8,10,13,7], "target": 92 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [7,7,6,14,7,4], "target": 45 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [9,10,9,7,14,3,6,4,6], "target": 68 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [15,13,14,5,7,13,11,14], "target": 92 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [1,1,10,12,5,6,15,6,8], "target": 64 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [14,13,13,11,14,13,8], "target": 86 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [3,14,4,2,10,3,7], "target": 43 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

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

test_input = { "nums": [6,2,5,4,12], "target": 29 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [7,11,15,1,9,9,11], "target": 63 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [7,12,10,15,6,15,14,2], "target": 81 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [12,3,10,12,13,3,4,7,15], "target": 79 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [14,6,11,2,10,1,12,9,2], "target": 67 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [5,8,12,6,15,13,11], "target": 70 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [11,6,1,6,2,6,15], "target": 47 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [12,7,15,10,5,4,7,12,12], "target": 84 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [11,4,4,9,10,7,12], "target": 57 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [4,12,15,6,15,1,4,4,2], "target": 63 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [3,13,4,15,1], "target": 36 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [14,3,7,14,7,7,1,6], "target": 59 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

test_input = { "nums": [15,13,1,14,6,8], "target": 57 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [14,2,3,10,15], "target": 44 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5

test_input = { "nums": [5,5,3,7,12,10,11], "target": 53 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [3,7,3,5,3,14,8], "target": 43 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [5,7,9,14,9,14,4,1,4], "target": 67 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [12,7,8,6,3,9,7,3,4,4], "target": 63 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [9,12,1,4,9,6,15,9,7], "target": 72 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [9,13,12,10,4,9,9,4,4,13], "target": 87 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 10

test_input = { "nums": [13,5,6,8,2,13,1,5,6], "target": 59 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [7,9,8,9,9,3,5], "target": 50 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

test_input = { "nums": [15,1,14,8,2,1,10,15,15], "target": 81 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [13,14,1,9,12,2], "target": 51 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

test_input = { "nums": [13,12,12,13,8,11,3,14,13], "target": 99 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [2,2,1,12,10,7,11,5,5], "target": 55 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [13,10,3,4,10,3], "target": 43 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 6

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

test_input = { "nums": [10,1,4,10,9,13,14], "target": 61 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 7

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

test_input = { "nums": [4,11,6,6,14,12,2,9,1], "target": 65 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 9

test_input = { "nums": [9,2,15,12,15,6,4,12], "target": 75 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 8

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

test_input = { "nums": [4,3,13,6,9], "target": 35 }
assert my_solution.lengthOfLongestSubsequence(**test_input) == 5


subarrays-distinct-element-sum-of-squares-ii

Subarrays Distinct Element Sum of Squares II

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

The distinct count of a subarray of nums is defined as:

 * Let nums[i..j] be a subarray of nums consisting of all the indices from i to j such that 0 <= i <= j < nums.length. Then the number of distinct values in nums[i..j] is called the distinct count of nums[i..j].

Return the sum of the squares of distinct counts of all subarrays of nums.

Since the answer may be very large, return it modulo 109 + 7.

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

Example 1:

Input: nums = [1,2,1]
Output: 15
Explanation: Six possible subarrays are:
[1]: 1 distinct value
[2]: 1 distinct value
[1]: 1 distinct value
[1,2]: 2 distinct values
[2,1]: 2 distinct values
[1,2,1]: 2 distinct values
The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 + 22 + 22 + 22 = 15.

Example 2:

Input: nums = [2,2]
Output: 3
Explanation: Three possible subarrays are:
[2]: 1 distinct value
[2]: 1 distinct value
[2,2]: 1 distinct value
The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 = 3.

Constraints:

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

You are given a 0-indexed integer array nums.

The distinct count of a subarray of nums is defined as:

 * Let nums[i..j] be a subarray of nums consisting of all the indices from i to j such that 0 <= i <= j < nums.length. Then the number of distinct values in nums[i..j] is called the distinct count of nums[i..j].

Return the sum of the squares of distinct counts of all subarrays of nums.

Since the answer may be very large, return it modulo 109 + 7.

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

Example 1:

Input: nums = [1,2,1]
Output: 15
Explanation: Six possible subarrays are:
[1]: 1 distinct value
[2]: 1 distinct value
[1]: 1 distinct value
[1,2]: 2 distinct values
[2,1]: 2 distinct values
[1,2,1]: 2 distinct values
The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 + 22 + 22 + 22 = 15.

Example 2:

Input: nums = [2,2]
Output: 3
Explanation: Three possible subarrays are:
[2]: 1 distinct value
[2]: 1 distinct value
[2,2]: 1 distinct value
The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 = 3.

Constraints:

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

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


minimum-sum-of-mountain-triplets-i

Minimum Sum of Mountain Triplets I

Prompt:
"""
You are given a 0-indexed array nums of integers.

A triplet of indices (i, j, k) is a mountain if:

 * i < j < k
 * nums[i] < nums[j] and nums[k] < nums[j]

Return the minimum possible sum of a mountain triplet of nums. If no such triplet exists, return -1.

Example 1:

Input: nums = [8,6,1,5,3]
Output: 9
Explanation: Triplet (2, 3, 4) is a mountain triplet of sum 9 since:
- 2 < 3 < 4
- nums[2] < nums[3] and nums[4] < nums[3]
And the sum of this triplet is nums[2] + nums[3] + nums[4] = 9. It can be shown that there are no mountain triplets with a sum of less than 9.

Example 2:

Input: nums = [5,4,8,7,10,2]
Output: 13
Explanation: Triplet (1, 3, 5) is a mountain triplet of sum 13 since:
- 1 < 3 < 5
- nums[1] < nums[3] and nums[5] < nums[3]
And the sum of this triplet is nums[1] + nums[3] + nums[5] = 13. It can be shown that there are no mountain triplets with a sum of less than 13.

Example 3:

Input: nums = [6,5,4,3,4,5]
Output: -1
Explanation: It can be shown that there are no mountain triplets in nums.

Constraints:

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

You are given a 0-indexed array nums of integers.

A triplet of indices (i, j, k) is a mountain if:

 * i < j < k
 * nums[i] < nums[j] and nums[k] < nums[j]

Return the minimum possible sum of a mountain triplet of nums. If no such triplet exists, return -1.

Example 1:

Input: nums = [8,6,1,5,3]
Output: 9
Explanation: Triplet (2, 3, 4) is a mountain triplet of sum 9 since:
- 2 < 3 < 4
- nums[2] < nums[3] and nums[4] < nums[3]
And the sum of this triplet is nums[2] + nums[3] + nums[4] = 9. It can be shown that there are no mountain triplets with a sum of less than 9.

Example 2:

Input: nums = [5,4,8,7,10,2]
Output: 13
Explanation: Triplet (1, 3, 5) is a mountain triplet of sum 13 since:
- 1 < 3 < 5
- nums[1] < nums[3] and nums[5] < nums[3]
And the sum of this triplet is nums[1] + nums[3] + nums[5] = 13. It can be shown that there are no mountain triplets with a sum of less than 13.

Example 3:

Input: nums = [6,5,4,3,4,5]
Output: -1
Explanation: It can be shown that there are no mountain triplets in nums.

Constraints:

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

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

```

my_solution = Solution()

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

test_input = { "nums": [5,4,8,7,10,2] }
assert my_solution.minimumSum(**test_input) == 13

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

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

test_input = { "nums": [49,50,48] }
assert my_solution.minimumSum(**test_input) == 147

test_input = { "nums": [48,50,49] }
assert my_solution.minimumSum(**test_input) == 147

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


minimum-sum-of-mountain-triplets-ii

Minimum Sum of Mountain Triplets II

Prompt:
"""
You are given a 0-indexed array nums of integers.

A triplet of indices (i, j, k) is a mountain if:

 * i < j < k
 * nums[i] < nums[j] and nums[k] < nums[j]

Return the minimum possible sum of a mountain triplet of nums. If no such triplet exists, return -1.

Example 1:

Input: nums = [8,6,1,5,3]
Output: 9
Explanation: Triplet (2, 3, 4) is a mountain triplet of sum 9 since:
- 2 < 3 < 4
- nums[2] < nums[3] and nums[4] < nums[3]
And the sum of this triplet is nums[2] + nums[3] + nums[4] = 9. It can be shown that there are no mountain triplets with a sum of less than 9.

Example 2:

Input: nums = [5,4,8,7,10,2]
Output: 13
Explanation: Triplet (1, 3, 5) is a mountain triplet of sum 13 since:
- 1 < 3 < 5
- nums[1] < nums[3] and nums[5] < nums[3]
And the sum of this triplet is nums[1] + nums[3] + nums[5] = 13. It can be shown that there are no mountain triplets with a sum of less than 13.

Example 3:

Input: nums = [6,5,4,3,4,5]
Output: -1
Explanation: It can be shown that there are no mountain triplets in nums.

Constraints:

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

You are given a 0-indexed array nums of integers.

A triplet of indices (i, j, k) is a mountain if:

 * i < j < k
 * nums[i] < nums[j] and nums[k] < nums[j]

Return the minimum possible sum of a mountain triplet of nums. If no such triplet exists, return -1.

Example 1:

Input: nums = [8,6,1,5,3]
Output: 9
Explanation: Triplet (2, 3, 4) is a mountain triplet of sum 9 since:
- 2 < 3 < 4
- nums[2] < nums[3] and nums[4] < nums[3]
And the sum of this triplet is nums[2] + nums[3] + nums[4] = 9. It can be shown that there are no mountain triplets with a sum of less than 9.

Example 2:

Input: nums = [5,4,8,7,10,2]
Output: 13
Explanation: Triplet (1, 3, 5) is a mountain triplet of sum 13 since:
- 1 < 3 < 5
- nums[1] < nums[3] and nums[5] < nums[3]
And the sum of this triplet is nums[1] + nums[3] + nums[5] = 13. It can be shown that there are no mountain triplets with a sum of less than 13.

Example 3:

Input: nums = [6,5,4,3,4,5]
Output: -1
Explanation: It can be shown that there are no mountain triplets in nums.

Constraints:

 * 3 <= nums.length <= 105
 * 1 <= nums[i] <= 108

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

```

my_solution = Solution()

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

test_input = { "nums": [5,4,8,7,10,2] }
assert my_solution.minimumSum(**test_input) == 13

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

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

test_input = { "nums": [49,50,48] }
assert my_solution.minimumSum(**test_input) == 147

test_input = { "nums": [48,50,49] }
assert my_solution.minimumSum(**test_input) == 147

test_input = { "nums": [99999999,100000000,99999999] }
assert my_solution.minimumSum(**test_input) == 299999998

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


minimum-number-of-groups-to-create-a-valid-assignment

Minimum Number of Groups to Create a Valid Assignment

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

We want to group the indices so for each index i in the range [0, n - 1], it is assigned to exactly one group.

A group assignment is valid if the following conditions hold:

 * For every group g, all indices i assigned to group g have the same value in nums.
 * For any two groups g1 and g2, the difference between the number of indices assigned to g1 and g2 should not exceed 1.

Return an integer denoting the minimum number of groups needed to create a valid group assignment.

Example 1:

Input: nums = [3,2,3,2,3]
Output: 2
Explanation: One way the indices can be assigned to 2 groups is as follows, where the values in square brackets are indices:
group 1 -> [0,2,4]
group 2 -> [1,3]
All indices are assigned to one group.
In group 1, nums[0] == nums[2] == nums[4], so all indices have the same value.
In group 2, nums[1] == nums[3], so all indices have the same value.
The number of indices assigned to group 1 is 3, and the number of indices assigned to group 2 is 2.
Their difference doesn't exceed 1.
It is not possible to use fewer than 2 groups because, in order to use just 1 group, all indices assigned to that group must have the same value.
Hence, the answer is 2.

Example 2:

Input: nums = [10,10,10,3,1,1]
Output: 4
Explanation: One way the indices can be assigned to 4 groups is as follows, where the values in square brackets are indices:
group 1 -> [0]
group 2 -> [1,2]
group 3 -> [3]
group 4 -> [4,5]
The group assignment above satisfies both conditions.
It can be shown that it is not possible to create a valid assignment using fewer than 4 groups.
Hence, the answer is 4.

Constraints:

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

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

We want to group the indices so for each index i in the range [0, n - 1], it is assigned to exactly one group.

A group assignment is valid if the following conditions hold:

 * For every group g, all indices i assigned to group g have the same value in nums.
 * For any two groups g1 and g2, the difference between the number of indices assigned to g1 and g2 should not exceed 1.

Return an integer denoting the minimum number of groups needed to create a valid group assignment.

Example 1:

Input: nums = [3,2,3,2,3]
Output: 2
Explanation: One way the indices can be assigned to 2 groups is as follows, where the values in square brackets are indices:
group 1 -> [0,2,4]
group 2 -> [1,3]
All indices are assigned to one group.
In group 1, nums[0] == nums[2] == nums[4], so all indices have the same value.
In group 2, nums[1] == nums[3], so all indices have the same value.
The number of indices assigned to group 1 is 3, and the number of indices assigned to group 2 is 2.
Their difference doesn't exceed 1.
It is not possible to use fewer than 2 groups because, in order to use just 1 group, all indices assigned to that group must have the same value.
Hence, the answer is 2.

Example 2:

Input: nums = [10,10,10,3,1,1]
Output: 4
Explanation: One way the indices can be assigned to 4 groups is as follows, where the values in square brackets are indices:
group 1 -> [0]
group 2 -> [1,2]
group 3 -> [3]
group 4 -> [4,5]
The group assignment above satisfies both conditions.
It can be shown that it is not possible to create a valid assignment using fewer than 4 groups.
Hence, the answer is 4.

Constraints:

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

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


minimum-changes-to-make-k-semi-palindromes

Minimum Changes to Make K Semi-palindromes

Prompt:
"""
Given a string s and an integer k, partition s into k substrings such that the sum of the number of letter changes required to turn each substring into a semi-palindrome is minimized.

Return an integer denoting the minimum number of letter changes required.

Notes

 * A string is a palindrome if it can be read the same way from left to right and right to left.
 * A string with a length of len is considered a semi-palindrome if there exists a positive integer d such that 1 <= d < len and len % d == 0, and if we take indices that have the same modulo by d, they form a palindrome. For example, "aa", "aba", "adbgad", and, "abab" are semi-palindrome and "a", "ab", and, "abca" are not.
 * A substring is a contiguous sequence of characters within a string.

Example 1:

Input: s = "abcac", k = 2
Output: 1
Explanation: We can divide s into substrings "ab" and "cac". The string "cac" is already a semi-palindrome. If we change "ab" to "aa", it becomes a semi-palindrome with d = 1.
It can be shown that there is no way to divide the string "abcac" into two semi-palindrome substrings. Therefore, the answer would be at least 1.

Example 2:

Input: s = "abcdef", k = 2
Output: 2
Explanation: We can divide it into substrings "abc" and "def". Each of the substrings "abc" and "def" requires one change to become a semi-palindrome, so we need 2 changes in total to make all substrings semi-palindrome.
It can be shown that we cannot divide the given string into two substrings in a way that it would require less than 2 changes.

Example 3:

Input: s = "aabbaa", k = 3
Output: 0
Explanation: We can divide it into substrings "aa", "bb" and "aa".
The strings "aa" and "bb" are already semi-palindromes. Thus, the answer is zero.

Constraints:

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

Given a string s and an integer k, partition s into k substrings such that the sum of the number of letter changes required to turn each substring into a semi-palindrome is minimized.

Return an integer denoting the minimum number of letter changes required.

Notes

 * A string is a palindrome if it can be read the same way from left to right and right to left.
 * A string with a length of len is considered a semi-palindrome if there exists a positive integer d such that 1 <= d < len and len % d == 0, and if we take indices that have the same modulo by d, they form a palindrome. For example, "aa", "aba", "adbgad", and, "abab" are semi-palindrome and "a", "ab", and, "abca" are not.
 * A substring is a contiguous sequence of characters within a string.

Example 1:

Input: s = "abcac", k = 2
Output: 1
Explanation: We can divide s into substrings "ab" and "cac". The string "cac" is already a semi-palindrome. If we change "ab" to "aa", it becomes a semi-palindrome with d = 1.
It can be shown that there is no way to divide the string "abcac" into two semi-palindrome substrings. Therefore, the answer would be at least 1.

Example 2:

Input: s = "abcdef", k = 2
Output: 2
Explanation: We can divide it into substrings "abc" and "def". Each of the substrings "abc" and "def" requires one change to become a semi-palindrome, so we need 2 changes in total to make all substrings semi-palindrome.
It can be shown that we cannot divide the given string into two substrings in a way that it would require less than 2 changes.

Example 3:

Input: s = "aabbaa", k = 3
Output: 0
Explanation: We can divide it into substrings "aa", "bb" and "aa".
The strings "aa" and "bb" are already semi-palindromes. Thus, the answer is zero.

Constraints:

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

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

```

my_solution = Solution()

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

test_input = { "s": "abcdef", "k": 2 }
assert my_solution.minimumChanges(**test_input) == 2

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

test_input = { "s": "aq", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 1

test_input = { "s": "bb", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 0

test_input = { "s": "aac", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 1

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

test_input = { "s": "acba", "k": 2 }
assert my_solution.minimumChanges(**test_input) == 2

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

test_input = { "s": "aabcbaa", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 0

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

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

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

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

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

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

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

test_input = { "s": "babcbaccba", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 1

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

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

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

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

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

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

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

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

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

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

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

test_input = { "s": "bcacacacaab", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 1

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

test_input = { "s": "bccaaccacb", "k": 2 }
assert my_solution.minimumChanges(**test_input) == 2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "s": "acbcbccccba", "k": 2 }
assert my_solution.minimumChanges(**test_input) == 2

test_input = { "s": "bbcaaaaacbb", "k": 2 }
assert my_solution.minimumChanges(**test_input) == 2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "s": "bbababccabca", "k": 2 }
assert my_solution.minimumChanges(**test_input) == 2

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

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

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

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

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

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

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

test_input = { "s": "bvatyzbdffqdp", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 6

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

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

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

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

test_input = { "s": "ccbacacbcbac", "k": 2 }
assert my_solution.minimumChanges(**test_input) == 2

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

test_input = { "s": "feecuhvurk", "k": 4 }
assert my_solution.minimumChanges(**test_input) == 4

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

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

test_input = { "s": "gdlitshyeehtx", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 6

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

test_input = { "s": "kxvwhuewyftpp", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 6

test_input = { "s": "mrqvwotsqjtfv", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 6

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

test_input = { "s": "rbiuxrgidyzuu", "k": 1 }
assert my_solution.minimumChanges(**test_input) == 6

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

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


find-indices-with-index-and-value-difference-i

Find Indices With Index and Value Difference I

Prompt:
"""
You are given a 0-indexed integer array nums having length n, an integer indexDifference, and an integer valueDifference.

Your task is to find two indices i and j, both in the range [0, n - 1], that satisfy the following conditions:

 * abs(i - j) >= indexDifference, and
 * abs(nums[i] - nums[j]) >= valueDifference

Return an integer array answer, where answer = [i, j] if there are two such indices, and answer = [-1, -1] otherwise. If there are multiple choices for the two indices, return any of them.

Note: i and j may be equal.

Example 1:

Input: nums = [5,1,4,1], indexDifference = 2, valueDifference = 4
Output: [0,3]
Explanation: In this example, i = 0 and j = 3 can be selected.
abs(0 - 3) >= 2 and abs(nums[0] - nums[3]) >= 4.
Hence, a valid answer is [0,3].
[3,0] is also a valid answer.

Example 2:

Input: nums = [2,1], indexDifference = 0, valueDifference = 0
Output: [0,0]
Explanation: In this example, i = 0 and j = 0 can be selected.
abs(0 - 0) >= 0 and abs(nums[0] - nums[0]) >= 0.
Hence, a valid answer is [0,0].
Other valid answers are [0,1], [1,0], and [1,1].

Example 3:

Input: nums = [1,2,3], indexDifference = 2, valueDifference = 4
Output: [-1,-1]
Explanation: In this example, it can be shown that it is impossible to find two indices that satisfy both conditions.
Hence, [-1,-1] is returned.

Constraints:

 * 1 <= n == nums.length <= 100
 * 0 <= nums[i] <= 50
 * 0 <= indexDifference <= 100
 * 0 <= valueDifference <= 50
"""
class Solution:
    def findIndices(self, nums: List[int], indexDifference: int, valueDifference: int) -> List[int]:

You are given a 0-indexed integer array nums having length n, an integer indexDifference, and an integer valueDifference.

Your task is to find two indices i and j, both in the range [0, n - 1], that satisfy the following conditions:

 * abs(i - j) >= indexDifference, and
 * abs(nums[i] - nums[j]) >= valueDifference

Return an integer array answer, where answer = [i, j] if there are two such indices, and answer = [-1, -1] otherwise. If there are multiple choices for the two indices, return any of them.

Note: i and j may be equal.

Example 1:

Input: nums = [5,1,4,1], indexDifference = 2, valueDifference = 4
Output: [0,3]
Explanation: In this example, i = 0 and j = 3 can be selected.
abs(0 - 3) >= 2 and abs(nums[0] - nums[3]) >= 4.
Hence, a valid answer is [0,3].
[3,0] is also a valid answer.

Example 2:

Input: nums = [2,1], indexDifference = 0, valueDifference = 0
Output: [0,0]
Explanation: In this example, i = 0 and j = 0 can be selected.
abs(0 - 0) >= 0 and abs(nums[0] - nums[0]) >= 0.
Hence, a valid answer is [0,0].
Other valid answers are [0,1], [1,0], and [1,1].

Example 3:

Input: nums = [1,2,3], indexDifference = 2, valueDifference = 4
Output: [-1,-1]
Explanation: In this example, it can be shown that it is impossible to find two indices that satisfy both conditions.
Hence, [-1,-1] is returned.

Constraints:

 * 1 <= n == nums.length <= 100
 * 0 <= nums[i] <= 50
 * 0 <= indexDifference <= 100
 * 0 <= valueDifference <= 50

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

```

my_solution = Solution()

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

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

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

test_input = { "nums": [0], "indexDifference": 0, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [0,0]

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

test_input = { "nums": [3], "indexDifference": 1, "valueDifference": 1 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [4], "indexDifference": 1, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [5], "indexDifference": 1, "valueDifference": 3 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [7], "indexDifference": 1, "valueDifference": 7 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [8], "indexDifference": 0, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [8], "indexDifference": 1, "valueDifference": 7 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [10], "indexDifference": 0, "valueDifference": 9 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [11], "indexDifference": 1, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [18], "indexDifference": 1, "valueDifference": 4 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [38], "indexDifference": 1, "valueDifference": 34 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [40], "indexDifference": 1, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [5,10], "indexDifference": 1, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [5,48], "indexDifference": 0, "valueDifference": 29 }
assert my_solution.findIndices(**test_input) == [0,1]

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

test_input = { "nums": [7,6], "indexDifference": 1, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [8,8], "indexDifference": 1, "valueDifference": 1 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [17,31], "indexDifference": 1, "valueDifference": 9 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [21,22], "indexDifference": 1, "valueDifference": 21 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [48,40], "indexDifference": 2, "valueDifference": 31 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [2,8,0], "indexDifference": 2, "valueDifference": 7 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [2,29,0], "indexDifference": 0, "valueDifference": 12 }
assert my_solution.findIndices(**test_input) == [0,1]

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

test_input = { "nums": [4,22,43], "indexDifference": 0, "valueDifference": 34 }
assert my_solution.findIndices(**test_input) == [0,2]

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

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

test_input = { "nums": [6,2,7], "indexDifference": 2, "valueDifference": 5 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [6,5,1], "indexDifference": 2, "valueDifference": 6 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [6,8,0], "indexDifference": 1, "valueDifference": 3 }
assert my_solution.findIndices(**test_input) == [0,2]

test_input = { "nums": [7,36,21], "indexDifference": 1, "valueDifference": 20 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [9,4,7], "indexDifference": 0, "valueDifference": 9 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [9,50,31], "indexDifference": 1, "valueDifference": 8 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [31,23,36], "indexDifference": 1, "valueDifference": 11 }
assert my_solution.findIndices(**test_input) == [1,2]

test_input = { "nums": [40,21,1], "indexDifference": 2, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [0,2]

test_input = { "nums": [0,5,10,5], "indexDifference": 3, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [1,28,24,35], "indexDifference": 3, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [2,7,10,4], "indexDifference": 0, "valueDifference": 5 }
assert my_solution.findIndices(**test_input) == [0,1]

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

test_input = { "nums": [7,5,6,2], "indexDifference": 2, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [9,3,6,4], "indexDifference": 1, "valueDifference": 5 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [34,46,11,45], "indexDifference": 1, "valueDifference": 3 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [36,37,40,9], "indexDifference": 2, "valueDifference": 8 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [37,25,48,13], "indexDifference": 0, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [0,0]

test_input = { "nums": [45,6,29,21], "indexDifference": 3, "valueDifference": 36 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [1,5,7,9,2], "indexDifference": 3, "valueDifference": 8 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [7,2,1,8,3], "indexDifference": 0, "valueDifference": 7 }
assert my_solution.findIndices(**test_input) == [2,3]

test_input = { "nums": [8,9,8,0,4], "indexDifference": 1, "valueDifference": 6 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [9,1,10,0,10], "indexDifference": 0, "valueDifference": 3 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [9,9,4,5,5], "indexDifference": 2, "valueDifference": 9 }
assert my_solution.findIndices(**test_input) == [-1,-1]

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

test_input = { "nums": [17,46,31,28,28], "indexDifference": 0, "valueDifference": 46 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [17,49,1,47,12], "indexDifference": 2, "valueDifference": 17 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [32,49,3,40,44], "indexDifference": 1, "valueDifference": 37 }
assert my_solution.findIndices(**test_input) == [1,2]

test_input = { "nums": [46,43,16,16,34], "indexDifference": 3, "valueDifference": 13 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [49,36,18,4,33], "indexDifference": 3, "valueDifference": 20 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [0,7,10,6,6,5], "indexDifference": 1, "valueDifference": 5 }
assert my_solution.findIndices(**test_input) == [0,1]

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

test_input = { "nums": [3,8,9,7,2,3], "indexDifference": 3, "valueDifference": 6 }
assert my_solution.findIndices(**test_input) == [1,4]

test_input = { "nums": [3,27,38,47,38,4], "indexDifference": 0, "valueDifference": 10 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [4,13,48,50,1,26], "indexDifference": 4, "valueDifference": 34 }
assert my_solution.findIndices(**test_input) == [-1,-1]

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

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

test_input = { "nums": [7,3,7,5,7,9], "indexDifference": 1, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [12,37,7,16,5,34], "indexDifference": 3, "valueDifference": 27 }
assert my_solution.findIndices(**test_input) == [1,4]

test_input = { "nums": [17,46,48,25,22,4], "indexDifference": 2, "valueDifference": 30 }
assert my_solution.findIndices(**test_input) == [0,2]

test_input = { "nums": [18,18,7,10,9,50], "indexDifference": 2, "valueDifference": 32 }
assert my_solution.findIndices(**test_input) == [0,5]

test_input = { "nums": [18,42,37,13,49,42], "indexDifference": 3, "valueDifference": 46 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [23,31,14,42,0,49], "indexDifference": 4, "valueDifference": 44 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [50,46,15,16,48,7], "indexDifference": 1, "valueDifference": 7 }
assert my_solution.findIndices(**test_input) == [0,2]

test_input = { "nums": [5,6,8,5,6,3,1], "indexDifference": 0, "valueDifference": 4 }
assert my_solution.findIndices(**test_input) == [0,6]

test_input = { "nums": [5,50,13,3,44,7,29], "indexDifference": 1, "valueDifference": 45 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [8,7,18,47,27,25,41], "indexDifference": 0, "valueDifference": 45 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [9,1,0,6,7,5,8], "indexDifference": 1, "valueDifference": 1 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [11,3,36,17,13,0,26], "indexDifference": 2, "valueDifference": 33 }
assert my_solution.findIndices(**test_input) == [2,5]

test_input = { "nums": [13,0,16,32,47,27,25], "indexDifference": 1, "valueDifference": 35 }
assert my_solution.findIndices(**test_input) == [1,4]

test_input = { "nums": [13,16,30,33,50,50,38], "indexDifference": 3, "valueDifference": 30 }
assert my_solution.findIndices(**test_input) == [0,4]

test_input = { "nums": [21,44,22,1,21,9,17], "indexDifference": 1, "valueDifference": 41 }
assert my_solution.findIndices(**test_input) == [1,3]

test_input = { "nums": [35,31,36,28,49,4,46], "indexDifference": 4, "valueDifference": 27 }
assert my_solution.findIndices(**test_input) == [0,5]

test_input = { "nums": [39,18,49,25,40,41,26], "indexDifference": 1, "valueDifference": 43 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [40,46,11,36,25,46,47], "indexDifference": 0, "valueDifference": 37 }
assert my_solution.findIndices(**test_input) == [-1,-1]

test_input = { "nums": [46,7,6,3,43,7,48], "indexDifference": 0, "valueDifference": 48 }
assert my_solution.findIndices(**test_input) == [-1,-1]

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

test_input = { "nums": [1,0,6,4,8,7,2,5], "indexDifference": 3, "valueDifference": 7 }
assert my_solution.findIndices(**test_input) == [0,4]

test_input = { "nums": [3,8,3,8,0,5,5,7], "indexDifference": 4, "valueDifference": 6 }
assert my_solution.findIndices(**test_input) == [-1,-1]

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

test_input = { "nums": [6,1,3,7,4,4,2,1], "indexDifference": 0, "valueDifference": 5 }
assert my_solution.findIndices(**test_input) == [0,1]

test_input = { "nums": [9,36,31,2,46,1,27,37], "indexDifference": 3, "valueDifference": 45 }
assert my_solution.findIndices(**test_input) == [-1,-1]

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

test_input = { "nums": [26,20,19,36,20,28,33,39], "indexDifference": 0, "valueDifference": 0 }
assert my_solution.findIndices(**test_input) == [0,0]

test_input = { "nums": [29,3,30,34,25,40,10,37], "indexDifference": 5, "valueDifference": 22 }
assert my_solution.findIndices(**test_input) == [1,7]

test_input = { "nums": [39,26,46,9,5,34,0,20], "indexDifference": 0, "valueDifference": 24 }
assert my_solution.findIndices(**test_input) == [0,3]

test_input = { "nums": [46,12,38,21,12,9,18,29], "indexDifference": 3, "valueDifference": 35 }
assert my_solution.findIndices(**test_input) == [0,5]

test_input = { "nums": [1,7,7,2,4,10,1,5,9], "indexDifference": 4, "valueDifference": 4 }
assert my_solution.findIndices(**test_input) == [0,5]

test_input = { "nums": [2,4,1,5,2,0,3,5,7], "indexDifference": 5, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [0,5]

test_input = { "nums": [2,5,6,5,9,7,2,3,6], "indexDifference": 4, "valueDifference": 2 }
assert my_solution.findIndices(**test_input) == [0,4]

test_input = { "nums": [2,6,9,4,9,4,10,9,2], "indexDifference": 0, "valueDifference": 4 }
assert my_solution.findIndices(**test_input) == [0,1]