make-lexicographically-smallest-array-by-swapping-elements

Make Lexicographically Smallest Array by Swapping Elements

Prompt:
"""
给你一个下标从 0 开始的 正整数 数组 nums 和一个 正整数 limit 。
在一次操作中，你可以选择任意两个下标 i 和 j，如果 满足 |nums[i] - nums[j]| <= limit ，则交换 nums[i] 和 nums[j] 。
返回执行任意次操作后能得到的 字典序最小的数组 。
如果在数组 a 和数组 b 第一个不同的位置上，数组 a 中的对应元素比数组 b 中的对应元素的字典序更小，则认为数组 a 就比数组 b 字典序更小。例如，数组 [2,10,3] 比数组 [10,2,3] 字典序更小，下标 0 处是两个数组第一个不同的位置，且 2 < 10 。

示例 1：

输入：nums = [1,5,3,9,8], limit = 2
输出：[1,3,5,8,9]
解释：执行 2 次操作：
- 交换 nums[1] 和 nums[2] 。数组变为 [1,3,5,9,8] 。
- 交换 nums[3] 和 nums[4] 。数组变为 [1,3,5,8,9] 。
即便执行更多次操作，也无法得到字典序更小的数组。
注意，执行不同的操作也可能会得到相同的结果。

示例 2：

输入：nums = [1,7,6,18,2,1], limit = 3
输出：[1,6,7,18,1,2]
解释：执行 3 次操作：
- 交换 nums[1] 和 nums[2] 。数组变为 [1,6,7,18,2,1] 。
- 交换 nums[0] 和 nums[4] 。数组变为 [2,6,7,18,1,1] 。
- 交换 nums[0] 和 nums[5] 。数组变为 [1,6,7,18,1,2] 。
即便执行更多次操作，也无法得到字典序更小的数组。

示例 3：

输入：nums = [1,7,28,19,10], limit = 3
输出：[1,7,28,19,10]
解释：[1,7,28,19,10] 是字典序最小的数组，因为不管怎么选择下标都无法执行操作。

提示：

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

给你一个下标从 0 开始的 正整数 数组 nums 和一个 正整数 limit 。
在一次操作中，你可以选择任意两个下标 i 和 j，如果 满足 |nums[i] - nums[j]| <= limit ，则交换 nums[i] 和 nums[j] 。
返回执行任意次操作后能得到的 字典序最小的数组 。
如果在数组 a 和数组 b 第一个不同的位置上，数组 a 中的对应元素比数组 b 中的对应元素的字典序更小，则认为数组 a 就比数组 b 字典序更小。例如，数组 [2,10,3] 比数组 [10,2,3] 字典序更小，下标 0 处是两个数组第一个不同的位置，且 2 < 10 。

示例 1：

输入：nums = [1,5,3,9,8], limit = 2
输出：[1,3,5,8,9]
解释：执行 2 次操作：
- 交换 nums[1] 和 nums[2] 。数组变为 [1,3,5,9,8] 。
- 交换 nums[3] 和 nums[4] 。数组变为 [1,3,5,8,9] 。
即便执行更多次操作，也无法得到字典序更小的数组。
注意，执行不同的操作也可能会得到相同的结果。

示例 2：

输入：nums = [1,7,6,18,2,1], limit = 3
输出：[1,6,7,18,1,2]
解释：执行 3 次操作：
- 交换 nums[1] 和 nums[2] 。数组变为 [1,6,7,18,2,1] 。
- 交换 nums[0] 和 nums[4] 。数组变为 [2,6,7,18,1,1] 。
- 交换 nums[0] 和 nums[5] 。数组变为 [1,6,7,18,1,2] 。
即便执行更多次操作，也无法得到字典序更小的数组。

示例 3：

输入：nums = [1,7,28,19,10], limit = 3
输出：[1,7,28,19,10]
解释：[1,7,28,19,10] 是字典序最小的数组，因为不管怎么选择下标都无法执行操作。

提示：

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

请完成下面的代码来解决上述问题:
```python
class Solution:
    def lexicographicallySmallestArray(self, nums: List[int], limit: int) -> List[int]:

```

my_solution = Solution()

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

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

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

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

test_input = { "nums": [1,60,34,84,62,56,39,76,49,38], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,56,34,84,60,62,38,76,49,39]

test_input = { "nums": [1,81,10,79,36,2,87,12,20,77], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,77,10,79,36,2,81,12,20,87]

test_input = { "nums": [2,71,5,87,11,15,70,70,14,38], "limit": 14 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [2,70,5,87,11,14,70,71,15,38]

test_input = { "nums": [4,3,23,84,34,88,44,44,18,15], "limit": 3 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [3,4,23,84,34,88,44,44,15,18]

test_input = { "nums": [4,34,29,73,51,11,8,53,98,47], "limit": 10 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,29,34,73,47,8,11,51,98,53]

test_input = { "nums": [4,52,38,59,71,27,31,83,88,10], "limit": 14 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,27,31,38,52,59,71,83,88,10]

test_input = { "nums": [4,68,8,10,70,62,27,5,42,61], "limit": 11 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,61,5,8,62,68,27,10,42,70]

test_input = { "nums": [5,9,35,60,73,91,61,57,87,76], "limit": 11 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,9,35,57,73,76,60,61,87,91]

test_input = { "nums": [5,15,68,47,49,67,9,6,35,14], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,14,67,47,49,68,6,9,35,15]

test_input = { "nums": [5,16,43,15,66,21,58,74,55,66], "limit": 9 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,15,43,16,55,21,58,66,66,74]

test_input = { "nums": [5,30,92,4,31,2,17,39,15,7], "limit": 3 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [2,30,92,4,31,5,15,39,17,7]

test_input = { "nums": [5,38,68,80,64,79,50,5,8,95], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,38,64,79,68,80,50,5,8,95]

test_input = { "nums": [5,100,44,45,16,30,14,65,83,64], "limit": 15 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,100,14,16,30,44,45,64,83,65]

test_input = { "nums": [6,57,100,67,4,63,47,59,21,66], "limit": 8 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,57,100,59,6,63,47,66,21,67]

test_input = { "nums": [6,70,90,1,33,81,60,80,68,44], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,68,90,6,33,80,60,81,70,44]

test_input = { "nums": [6,74,74,74,30,70,91,74,76,41], "limit": 1 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [6,74,74,74,30,70,91,74,76,41]

test_input = { "nums": [6,77,68,15,3,98,56,22,81,72], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [6,77,68,15,3,98,56,22,81,72]

test_input = { "nums": [7,17,79,29,29,83,21,12,5,1], "limit": 10 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,5,79,7,12,83,17,21,29,29]

test_input = { "nums": [7,66,85,9,29,1,25,69,57,95], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,57,85,7,25,9,29,66,69,95]

test_input = { "nums": [7,73,1,97,13,55,74,29,76,19], "limit": 14 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,73,7,97,13,55,74,19,76,29]

test_input = { "nums": [8,4,47,23,73,79,63,62,35,51], "limit": 11 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,8,47,23,51,62,63,73,35,79]

test_input = { "nums": [8,17,20,100,59,98,64,78,64,53], "limit": 1 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [8,17,20,100,59,98,64,78,64,53]

test_input = { "nums": [8,70,99,5,49,27,79,2,57,49], "limit": 14 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [2,49,99,5,49,27,57,8,70,79]

test_input = { "nums": [9,67,94,37,5,90,43,13,27,21], "limit": 11 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,67,90,9,13,94,21,27,37,43]

test_input = { "nums": [10,22,17,76,6,64,51,60,65,37], "limit": 9 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [6,10,17,76,22,51,60,64,65,37]

test_input = { "nums": [10,34,63,88,76,30,70,80,52,13], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [10,30,63,88,70,34,76,80,52,13]

test_input = { "nums": [10,69,4,28,15,30,23,53,41,93], "limit": 9 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,69,10,15,23,28,30,53,41,93]

test_input = { "nums": [12,86,98,73,64,77,30,76,46,69], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [12,86,98,69,64,73,30,76,46,77]

test_input = { "nums": [13,43,32,15,45,69,58,89,64,76], "limit": 12 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [13,32,43,15,45,58,64,89,69,76]

test_input = { "nums": [13,70,11,74,73,21,4,45,95,38], "limit": 9 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,70,11,73,74,13,21,38,95,45]

test_input = { "nums": [14,15,53,11,38,18,27,69,55,2], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [2,11,53,14,15,18,27,69,55,38]

test_input = { "nums": [14,28,61,49,10,25,80,83,42,100], "limit": 3 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [14,25,61,49,10,28,80,83,42,100]

test_input = { "nums": [14,71,7,77,99,90,20,81,100,65], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [7,65,14,71,99,90,20,77,100,81]

test_input = { "nums": [14,95,75,100,33,98,88,2,74,26], "limit": 1 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [14,95,74,100,33,98,88,2,75,26]

test_input = { "nums": [15,29,16,37,10,70,58,5,33,76], "limit": 8 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,29,10,33,15,70,58,16,37,76]

test_input = { "nums": [15,33,1,74,47,6,60,95,78,72], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [15,33,1,72,47,6,60,95,74,78]

test_input = { "nums": [16,20,79,92,17,7,70,41,54,18], "limit": 6 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [16,17,79,92,18,7,70,41,54,20]

test_input = { "nums": [16,43,19,36,99,15,70,89,45,71], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [15,43,16,36,99,19,70,89,45,71]

test_input = { "nums": [17,99,88,73,13,1,3,5,55,4], "limit": 15 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,73,88,99,3,4,5,13,55,17]

test_input = { "nums": [18,97,57,1,23,36,77,80,47,91], "limit": 10 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [18,91,47,1,23,36,77,80,57,97]

test_input = { "nums": [19,25,49,96,35,69,81,81,51,50], "limit": 12 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [19,25,49,96,35,69,81,81,50,51]

test_input = { "nums": [19,37,12,11,70,99,88,36,64,9], "limit": 3 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [19,36,9,11,70,99,88,37,64,12]

test_input = { "nums": [19,64,26,5,70,10,17,66,51,36], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [5,51,10,17,64,19,26,66,70,36]

test_input = { "nums": [21,14,21,34,4,88,39,62,30,20], "limit": 12 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [4,14,20,21,21,88,30,62,34,39]

test_input = { "nums": [22,94,100,54,97,14,100,48,41,35], "limit": 6 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [22,94,97,48,100,14,100,54,35,41]

test_input = { "nums": [23,50,8,48,62,26,92,5,96,9], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [23,48,5,50,62,26,92,8,96,9]

test_input = { "nums": [25,47,34,69,36,91,14,44,37,2], "limit": 1 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [25,47,34,69,36,91,14,44,37,2]

test_input = { "nums": [25,58,36,16,42,57,17,96,10,2], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [2,57,10,16,17,58,25,96,36,42]

test_input = { "nums": [26,21,9,15,94,47,52,86,89,7], "limit": 9 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [7,9,15,21,86,47,52,89,94,26]

test_input = { "nums": [27,26,24,2,95,90,41,14,20,35], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [24,26,27,2,95,90,41,14,20,35]

test_input = { "nums": [27,56,68,41,39,80,60,36,24,5], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [24,56,60,27,36,68,80,39,41,5]

test_input = { "nums": [27,71,52,71,68,2,49,37,34,97], "limit": 8 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [27,68,49,71,71,2,52,34,37,97]

test_input = { "nums": [29,82,25,91,17,9,38,25,29,68], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [25,82,25,91,17,9,38,29,29,68]

test_input = { "nums": [30,48,76,86,21,1,55,49,90,9], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [30,48,76,86,21,1,55,49,90,9]

test_input = { "nums": [31,10,64,15,60,32,88,79,79,33], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [31,10,64,15,60,32,88,79,79,33]

test_input = { "nums": [32,70,43,51,40,73,56,39,75,45], "limit": 8 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [32,70,39,40,43,73,45,51,75,56]

test_input = { "nums": [32,95,51,87,29,43,21,55,45,84], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [32,95,51,87,29,43,21,55,45,84]

test_input = { "nums": [33,25,25,65,82,71,56,82,13,46], "limit": 14 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [13,25,25,33,46,56,65,71,82,82]

test_input = { "nums": [33,37,77,41,83,75,96,97,4,60], "limit": 15 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [33,37,60,41,75,77,83,96,4,97]

test_input = { "nums": [35,81,18,79,47,53,20,2,98,22], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [35,79,18,81,47,53,20,2,98,22]

test_input = { "nums": [36,39,100,4,44,33,65,11,15,35], "limit": 10 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [33,35,100,4,36,39,65,11,15,44]

test_input = { "nums": [38,56,60,98,21,15,70,37,24,61], "limit": 15 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [15,56,60,98,21,24,61,37,38,70]

test_input = { "nums": [39,36,18,39,99,51,68,92,5,38], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [36,38,18,39,99,51,68,92,5,39]

test_input = { "nums": [39,89,81,37,67,37,98,89,49,47], "limit": 12 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [37,81,89,37,67,39,89,98,47,49]

test_input = { "nums": [40,67,99,53,95,47,59,99,64,44], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [40,44,95,47,99,53,59,99,64,67]

test_input = { "nums": [40,97,72,48,55,91,83,82,91,63], "limit": 11 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [40,48,55,63,72,82,83,91,91,97]

test_input = { "nums": [41,10,22,43,17,38,67,7,68,70], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [38,7,10,41,17,43,67,22,68,70]

test_input = { "nums": [41,25,83,44,39,37,67,33,58,5], "limit": 1 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [41,25,83,44,39,37,67,33,58,5]

test_input = { "nums": [41,87,34,74,77,62,18,28,5,8], "limit": 1 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [41,87,34,74,77,62,18,28,5,8]

test_input = { "nums": [45,1,66,44,45,74,75,96,31,47], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [44,1,66,45,45,74,75,96,31,47]

test_input = { "nums": [45,64,77,71,73,6,24,55,82,25], "limit": 3 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [45,64,77,71,73,6,24,55,82,25]

test_input = { "nums": [46,72,1,33,1,51,78,96,44,20], "limit": 1 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [46,72,1,33,1,51,78,96,44,20]

test_input = { "nums": [47,32,72,79,16,69,85,70,87,73], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [47,32,69,79,16,70,85,72,87,73]

test_input = { "nums": [47,94,72,49,50,62,17,22,85,86], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [47,94,72,49,50,62,17,22,85,86]

test_input = { "nums": [48,39,45,58,26,57,38,63,82,80], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [48,38,45,57,26,58,39,63,80,82]

test_input = { "nums": [48,51,51,39,54,56,57,6,1,40], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [48,51,51,39,54,56,57,6,1,40]

test_input = { "nums": [49,4,95,24,20,12,70,60,82,62], "limit": 11 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [49,4,95,12,20,24,60,62,82,70]

test_input = { "nums": [49,7,92,79,43,88,31,89,36,97], "limit": 8 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [31,7,88,79,36,89,43,92,49,97]

test_input = { "nums": [49,16,32,11,7,57,69,41,52,23], "limit": 15 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [7,11,16,23,32,41,49,52,57,69]

test_input = { "nums": [49,26,82,77,52,76,90,23,64,42], "limit": 12 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [42,23,49,52,64,76,77,26,82,90]

test_input = { "nums": [49,62,63,32,57,22,74,87,42,19], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [19,22,32,42,49,57,62,63,74,87]

test_input = { "nums": [49,93,5,15,56,2,65,74,82,42], "limit": 13 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [42,49,2,5,56,15,65,74,82,93]

test_input = { "nums": [49,93,100,79,76,14,90,32,4,5], "limit": 10 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [49,90,93,76,79,4,100,32,5,14]

test_input = { "nums": [49,96,75,44,74,78,82,40,43,68], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [49,96,74,40,75,78,82,43,44,68]

test_input = { "nums": [51,61,49,11,69,78,40,98,68,36], "limit": 10 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [36,40,49,11,51,61,68,98,69,78]

test_input = { "nums": [51,99,52,80,83,69,18,49,71,13], "limit": 14 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [49,99,51,69,71,80,13,52,83,18]

test_input = { "nums": [52,28,93,16,33,37,37,21,47,64], "limit": 12 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [16,21,93,28,33,37,37,47,52,64]

test_input = { "nums": [53,7,99,22,3,50,62,70,56,40], "limit": 2 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [53,7,99,22,3,50,62,70,56,40]

test_input = { "nums": [53,17,39,72,5,78,40,3,84,20], "limit": 5 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [53,17,39,72,3,78,40,5,84,20]

test_input = { "nums": [53,71,55,38,26,89,20,98,55,21], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [53,71,55,38,26,89,20,98,55,21]

test_input = { "nums": [53,71,74,7,99,64,95,99,90,22], "limit": 9 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [53,64,71,7,90,74,95,99,99,22]

test_input = { "nums": [55,19,82,86,12,64,44,76,88,31], "limit": 4 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [55,19,82,86,12,64,44,76,88,31]

test_input = { "nums": [56,13,55,1,18,36,45,25,20,52], "limit": 14 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [1,13,18,20,25,36,45,52,55,56]

test_input = { "nums": [56,28,50,100,56,99,80,71,6,5], "limit": 7 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [50,28,56,99,56,100,80,71,5,6]

test_input = { "nums": [56,35,19,2,83,20,96,42,33,68], "limit": 3 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [56,33,19,2,83,20,96,42,35,68]

test_input = { "nums": [56,69,94,21,65,46,64,91,75,25], "limit": 5 }
assert my_solution.lexicographicallySmallestArray(**test_input) == [56,64,91,21,65,46,69,94,75,25]


count-beautiful-substrings-ii

Count Beautiful Substrings II

Prompt:
"""
给你一个字符串 s 和一个正整数 k 。
用 vowels 和 consonants 分别表示字符串中元音字母和辅音字母的数量。
如果某个字符串满足以下条件，则称其为 美丽字符串 ：

vowels == consonants，即元音字母和辅音字母的数量相等。
(vowels * consonants) % k == 0，即元音字母和辅音字母的数量的乘积能被 k 整除。

返回字符串 s 中 非空美丽子字符串 的数量。
子字符串是字符串中的一个连续字符序列。
英语中的 元音字母 为 'a'、'e'、'i'、'o' 和 'u' 。
英语中的 辅音字母 为除了元音字母之外的所有字母。

示例 1：

输入：s = "baeyh", k = 2
输出：2
解释：字符串 s 中有 2 个美丽子字符串。
- 子字符串 "baeyh"，vowels = 2（["a","e"]），consonants = 2（["y","h"]）。
可以看出字符串 "aeyh" 是美丽字符串，因为 vowels == consonants 且 vowels * consonants % k == 0 。
- 子字符串 "baeyh"，vowels = 2（["a","e"]），consonants = 2（["b","y"]）。
可以看出字符串 "baey" 是美丽字符串，因为 vowels == consonants 且 vowels * consonants % k == 0 。
可以证明字符串 s 中只有 2 个美丽子字符串。

示例 2：

输入：s = "abba", k = 1
输出：3
解释：字符串 s 中有 3 个美丽子字符串。
- 子字符串 "abba"，vowels = 1（["a"]），consonants = 1（["b"]）。
- 子字符串 "abba"，vowels = 1（["a"]），consonants = 1（["b"]）。
- 子字符串 "abba"，vowels = 2（["a","a"]），consonants = 2（["b","b"]）。
可以证明字符串 s 中只有 3 个美丽子字符串。

示例 3：

输入：s = "bcdf", k = 1
输出：0
解释：字符串 s 中没有美丽子字符串。

提示：

1 <= s.length <= 5 * 104
1 <= k <= 1000
s 仅由小写英文字母组成。
"""
class Solution:
    def beautifulSubstrings(self, s: str, k: int) -> int:

给你一个字符串 s 和一个正整数 k 。
用 vowels 和 consonants 分别表示字符串中元音字母和辅音字母的数量。
如果某个字符串满足以下条件，则称其为 美丽字符串 ：

vowels == consonants，即元音字母和辅音字母的数量相等。
(vowels * consonants) % k == 0，即元音字母和辅音字母的数量的乘积能被 k 整除。

返回字符串 s 中 非空美丽子字符串 的数量。
子字符串是字符串中的一个连续字符序列。
英语中的 元音字母 为 'a'、'e'、'i'、'o' 和 'u' 。
英语中的 辅音字母 为除了元音字母之外的所有字母。

示例 1：

输入：s = "baeyh", k = 2
输出：2
解释：字符串 s 中有 2 个美丽子字符串。
- 子字符串 "baeyh"，vowels = 2（["a","e"]），consonants = 2（["y","h"]）。
可以看出字符串 "aeyh" 是美丽字符串，因为 vowels == consonants 且 vowels * consonants % k == 0 。
- 子字符串 "baeyh"，vowels = 2（["a","e"]），consonants = 2（["b","y"]）。
可以看出字符串 "baey" 是美丽字符串，因为 vowels == consonants 且 vowels * consonants % k == 0 。
可以证明字符串 s 中只有 2 个美丽子字符串。

示例 2：

输入：s = "abba", k = 1
输出：3
解释：字符串 s 中有 3 个美丽子字符串。
- 子字符串 "abba"，vowels = 1（["a"]），consonants = 1（["b"]）。
- 子字符串 "abba"，vowels = 1（["a"]），consonants = 1（["b"]）。
- 子字符串 "abba"，vowels = 2（["a","a"]），consonants = 2（["b","b"]）。
可以证明字符串 s 中只有 3 个美丽子字符串。

示例 3：

输入：s = "bcdf", k = 1
输出：0
解释：字符串 s 中没有美丽子字符串。

提示：

1 <= s.length <= 5 * 104
1 <= k <= 1000
s 仅由小写英文字母组成。

请完成下面的代码来解决上述问题:
```python
class Solution:
    def beautifulSubstrings(self, s: str, k: int) -> int:

```

my_solution = Solution()

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

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

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

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

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

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

test_input = { "s": "eeebjoxxujuaeoqibd", "k": 8 }
assert my_solution.beautifulSubstrings(**test_input) == 4

test_input = { "s": "ilougekqlovegioemdvu", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 21

test_input = { "s": "tqaewreikaztwpfwnef", "k": 8 }
assert my_solution.beautifulSubstrings(**test_input) == 3

test_input = { "s": "oykiuhsafgfjumnzb", "k": 7 }
assert my_solution.beautifulSubstrings(**test_input) == 0

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

test_input = { "s": "svzauyuevujektj", "k": 5 }
assert my_solution.beautifulSubstrings(**test_input) == 3

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

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

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

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

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

test_input = { "s": "ouafupsuhid", "k": 6 }
assert my_solution.beautifulSubstrings(**test_input) == 0

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

test_input = { "s": "tlaiwoauazutusiaaui", "k": 10 }
assert my_solution.beautifulSubstrings(**test_input) == 0

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

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

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

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

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

test_input = { "s": "uopmyrsntjhiroikup", "k": 8 }
assert my_solution.beautifulSubstrings(**test_input) == 2

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

test_input = { "s": "eeizejuoxeumz", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 6

test_input = { "s": "uuouuaifnboeiulttio", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 10

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

test_input = { "s": "pulorolqcvhafexui", "k": 9 }
assert my_solution.beautifulSubstrings(**test_input) == 3

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

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

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

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

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

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

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

test_input = { "s": "iuhoezpooxcohtlapolo", "k": 1 }
assert my_solution.beautifulSubstrings(**test_input) == 39

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

test_input = { "s": "pueutaoyaxk", "k": 6 }
assert my_solution.beautifulSubstrings(**test_input) == 0

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

test_input = { "s": "agntyaazvpejidwaph", "k": 8 }
assert my_solution.beautifulSubstrings(**test_input) == 1

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

test_input = { "s": "coiyakadxi", "k": 2 }
assert my_solution.beautifulSubstrings(**test_input) == 8

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

test_input = { "s": "jeayap", "k": 1 }
assert my_solution.beautifulSubstrings(**test_input) == 7

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

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

test_input = { "s": "fheabmlsyeeeuoeogyz", "k": 9 }
assert my_solution.beautifulSubstrings(**test_input) == 5

test_input = { "s": "eaizneuxi", "k": 1 }
assert my_solution.beautifulSubstrings(**test_input) == 10

test_input = { "s": "uurqufaucsuoqljh", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 14

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

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

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

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

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

test_input = { "s": "qeaxut", "k": 1 }
assert my_solution.beautifulSubstrings(**test_input) == 7

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

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

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

test_input = { "s": "uqiwuoevkfhkkua", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 6

test_input = { "s": "kavuaaeodvaxicm", "k": 6 }
assert my_solution.beautifulSubstrings(**test_input) == 0

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

test_input = { "s": "iaabaofuodcbek", "k": 5 }
assert my_solution.beautifulSubstrings(**test_input) == 3

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

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

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

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

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

test_input = { "s": "ehaascocsdmgekni", "k": 9 }
assert my_solution.beautifulSubstrings(**test_input) == 3

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

test_input = { "s": "vaeiiioidiioxhduu", "k": 7 }
assert my_solution.beautifulSubstrings(**test_input) == 0

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

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

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

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

test_input = { "s": "ghooirorxge", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 6

test_input = { "s": "fodartekaonq", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 9

test_input = { "s": "feeanzkjpfehzeuni", "k": 6 }
assert my_solution.beautifulSubstrings(**test_input) == 0

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

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

test_input = { "s": "gondfjaeeuhbuuasgip", "k": 10 }
assert my_solution.beautifulSubstrings(**test_input) == 0

test_input = { "s": "djooomsffoonelyeode", "k": 3 }
assert my_solution.beautifulSubstrings(**test_input) == 14

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

test_input = { "s": "naipqentonee", "k": 4 }
assert my_solution.beautifulSubstrings(**test_input) == 8

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

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

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

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

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

test_input = { "s": "uxvjixdujgyfauo", "k": 8 }
assert my_solution.beautifulSubstrings(**test_input) == 1

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

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

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

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

test_input = { "s": "euojmsora", "k": 1 }
assert my_solution.beautifulSubstrings(**test_input) == 10

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

test_input = { "s": "uafuimcpxyeoixgbyeio", "k": 5 }
assert my_solution.beautifulSubstrings(**test_input) == 3

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


find-words-containing-character

Find Words Containing Character

Prompt:
"""
给你一个下标从 0开始的字符串数组words和一个字符x。
请你返回一个 下标数组，表示下标在数组中对应的单词包含字符 x。
注意，返回的数组可以是任意顺序。

示例 1：

输入：words = ["leet","code"], x = "e"
输出：[0,1]
解释："e" 在两个单词中都出现了："leet" 和 "code" 。所以我们返回下标 0 和 1 。

示例 2：

输入：words = ["abc","bcd","aaaa","cbc"], x = "a"
输出：[0,2]
解释："a" 在 "abc" 和 "aaaa" 中出现了，所以我们返回下标 0 和 2 。

示例 3：

输入：words = ["abc","bcd","aaaa","cbc"], x = "z"
输出：[]
解释："z" 没有在任何单词中出现。所以我们返回空数组。

提示：

1 <= words.length <= 50
1 <= words[i].length <= 50
x是一个小写英文字母。
words[i]只包含小写英文字母。
"""
class Solution:
    def findWordsContaining(self, words: List[str], x: str) -> List[int]:

给你一个下标从 0开始的字符串数组words和一个字符x。
请你返回一个 下标数组，表示下标在数组中对应的单词包含字符 x。
注意，返回的数组可以是任意顺序。

示例 1：

输入：words = ["leet","code"], x = "e"
输出：[0,1]
解释："e" 在两个单词中都出现了："leet" 和 "code" 。所以我们返回下标 0 和 1 。

示例 2：

输入：words = ["abc","bcd","aaaa","cbc"], x = "a"
输出：[0,2]
解释："a" 在 "abc" 和 "aaaa" 中出现了，所以我们返回下标 0 和 2 。

示例 3：

输入：words = ["abc","bcd","aaaa","cbc"], x = "z"
输出：[]
解释："z" 没有在任何单词中出现。所以我们返回空数组。

提示：

1 <= words.length <= 50
1 <= words[i].length <= 50
x是一个小写英文字母。
words[i]只包含小写英文字母。

请完成下面的代码来解决上述问题:
```python
class Solution:
    def findWordsContaining(self, words: List[str], x: str) -> List[int]:

```

my_solution = Solution()

test_input = { "words": ["leet","code"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == [0,1]

test_input = { "words": ["abc","bcd","aaaa","cbc"], "x": "a" }
assert my_solution.findWordsContaining(**test_input) == [0,2]

test_input = { "words": ["abc","bcd","aaaa","cbc"], "x": "z" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["sgtkshnss","m","ryvbkyvuz","ezittyjwgb","wudlwg"], "x": "x" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["lkwnhpbj","tlohm","juazsb","f","rq"], "x": "v" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["aaa","imvtfjmxr","wbzfoovjnf","hqwrwmi"], "x": "c" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["utyeachht","bgpkcs","skeecqvvvw","nccrd"], "x": "i" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["alcpxexztg","r"], "x": "h" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["ekcpg","pdknua","fot","janppw","ofomkfvx"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["dq","rlvopu"], "x": "d" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["wzppkd","jxvk","zaztizmwuv","hvcdtobr"], "x": "b" }
assert my_solution.findWordsContaining(**test_input) == [3]

test_input = { "words": ["y","hs","qznrkpi"], "x": "v" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["pze","yojczsb","mjvyr","i","xsygks"], "x": "q" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["qsgtjagcu","m"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["kidtwmw","ogh","trdedlh","wwbtlindg","naoylytpof","ujcbzwzkm","doamcoxdv"], "x": "o" }
assert my_solution.findWordsContaining(**test_input) == [1,4,6]

test_input = { "words": ["tsmeupctki"], "x": "t" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["dqxlbljmpf","uvdzfoiqg","jsnbnx","fbedae","nodewb","o","ivepktj"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == [1]

test_input = { "words": ["fjlmmecm","sautsoorhl","n","hsyco","amlukrpjpv","rmhdnj","g"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["khjchmeciv","vgx","xghr","bbufgegu","qyfxu"], "x": "r" }
assert my_solution.findWordsContaining(**test_input) == [2]

test_input = { "words": ["jhtcugtcpl","bvhlgmmla","ntfkwzite","imbtzafaj","sdl","t"], "x": "m" }
assert my_solution.findWordsContaining(**test_input) == [1,3]

test_input = { "words": ["kxoziqoafc","vifcxifq"], "x": "q" }
assert my_solution.findWordsContaining(**test_input) == [0,1]

test_input = { "words": ["ckfkjjsonl","scaaug","rmvqzyiwc","a","smymw"], "x": "p" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["t","exo","npr","skd","bxpmbu"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == [1]

test_input = { "words": ["eulsl","fwooyct","ypytexil"], "x": "c" }
assert my_solution.findWordsContaining(**test_input) == [1]

test_input = { "words": ["nhd","zheyegi","ogz","fpybmcc","ntbbwtde"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == [1,2]

test_input = { "words": ["gwzvusl","upcpvbfyxy","hg","yu","wsfqgzhh","zgphqacsyo"], "x": "o" }
assert my_solution.findWordsContaining(**test_input) == [5]

test_input = { "words": ["uiovpph","xxj","uwzxzvkobk"], "x": "r" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["abtrpwo","sgaegnavk","pfmv"], "x": "z" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["m","fxtphsdmgy","otq","vwuhhnebr","yen"], "x": "y" }
assert my_solution.findWordsContaining(**test_input) == [1,4]

test_input = { "words": ["irlzx","lbrknhl","roupfj","fskaieszo","nz","ijfyejq"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == [3,5]

test_input = { "words": ["raavc","tx"], "x": "l" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["bkpuvcrexw","hxtbcdprhr","ovt","xgurm","pjcz","sbhwpjmyz"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == [3]

test_input = { "words": ["f","xlmy","akbiqa","fobo"], "x": "s" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["mhan"], "x": "a" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["uisx"], "x": "o" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["znqdolksyn","keewspe","ffod","lah","gadhym","awnyymd","fvkl"], "x": "v" }
assert my_solution.findWordsContaining(**test_input) == [6]

test_input = { "words": ["ftujx","dnbwrurk","t","x","zjzhdl","jc"], "x": "t" }
assert my_solution.findWordsContaining(**test_input) == [0,2]

test_input = { "words": ["zrwf","thp","qecwlnq","w","teetdaxx"], "x": "t" }
assert my_solution.findWordsContaining(**test_input) == [1,4]

test_input = { "words": ["xyzgb","qflfrfqgaf"], "x": "l" }
assert my_solution.findWordsContaining(**test_input) == [1]

test_input = { "words": ["shnjr","qfvop"], "x": "y" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["fmwclqh","xbphhgreze","yi","gmtzrfdab","uicqa","n"], "x": "i" }
assert my_solution.findWordsContaining(**test_input) == [2,4]

test_input = { "words": ["jgkv","njhwihtv","v"], "x": "z" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["tqkwoofh","bcgngl","frjpqgrr","drvb"], "x": "x" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["npkvocbw","tn","dp","c","g","fsxvzcnty","ywnf"], "x": "k" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["leompil","vta","fzrsps","yp","bykmgwgk"], "x": "o" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["umq","c","ctuh","eadzeuui","tabum","isuct"], "x": "p" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["rnmpdkmrnb","icxxsvss","h","gd"], "x": "s" }
assert my_solution.findWordsContaining(**test_input) == [1]

test_input = { "words": ["ft","hsjf","e","xi"], "x": "w" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["ozf","xkehlkgp","vliewlbv","okgaahah"], "x": "b" }
assert my_solution.findWordsContaining(**test_input) == [2]

test_input = { "words": ["gbktzr","kbamubluz","dwoi","crhldx","idjronpded","rqaz"], "x": "c" }
assert my_solution.findWordsContaining(**test_input) == [3]

test_input = { "words": ["gvbzqcb","rwtbra","iuijl","qbmpbi"], "x": "c" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["lsh","szhxhcdc","quem","zupiydjeqp","czxyvysrrb","aqnlqtnfiv"], "x": "p" }
assert my_solution.findWordsContaining(**test_input) == [3]

test_input = { "words": ["leuah","liaoczeuch","ol","ify","layh","ifzudwuybw","x"], "x": "p" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["ksdpwwho","ktunsikyu"], "x": "a" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["vpypaumzlp","kqrb","pgw"], "x": "l" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["jkrpnx","c","kqi","xrsaviyusg","waoxq","fld","otxfgcp"], "x": "l" }
assert my_solution.findWordsContaining(**test_input) == [5]

test_input = { "words": ["tetw","zl","wd","hnkxoxlnz","dexgufawjd","oolpr","yyfwizbsl"], "x": "p" }
assert my_solution.findWordsContaining(**test_input) == [5]

test_input = { "words": ["hihprd","kitgiflc","nr","idduuahfkm"], "x": "x" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["flfxeca","g"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["st","betf","ipacxza","jpnw"], "x": "r" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["cvuxnzaib","c","tiytr","yiav","hp","yg"], "x": "d" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["yz","k","midujexvn","kwcgbht"], "x": "y" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["qcxobdaxv"], "x": "q" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["b","shrexcf","ve","eqpbnuy","qdhahodo","aerdf","bdjlaakagk"], "x": "p" }
assert my_solution.findWordsContaining(**test_input) == [3]

test_input = { "words": ["ympv"], "x": "q" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["thfy","lnfzoyafiy","qmc","boijcl","pvbzmsa","yjarwylcyc"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["hqptwi"], "x": "o" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["bv","xgrhtjnxh","fdtljkxa","po","hejof"], "x": "k" }
assert my_solution.findWordsContaining(**test_input) == [2]

test_input = { "words": ["mfdrclyx","pith"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["bxeblhrl","o","uvv"], "x": "b" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["giygz"], "x": "u" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["ffqw","nykncbxrqi","pgzy","of","oye","f"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == [2]

test_input = { "words": ["jjnh","nrbh","z"], "x": "l" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["gdzkdtvrm","ps","kp","sbdlkac","s","bt"], "x": "n" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["hpsk","stjltzz","gvbjwzktgg","hmeovbxvv","gqaxqoshbh","mqnwyabqq","sq"], "x": "f" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["gwmg","qdjeaxgc","rlajltxpd","d"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == [0,1]

test_input = { "words": ["dupx","r","j","wq","macfcfoz"], "x": "r" }
assert my_solution.findWordsContaining(**test_input) == [1]

test_input = { "words": ["rmypzoyto","wvhtrbuz","dgt","tmhqswmkx","trpjwzitp","tbetdxic"], "x": "t" }
assert my_solution.findWordsContaining(**test_input) == [0,1,2,3,4,5]

test_input = { "words": ["vpkjymgdb","s","gv","geie"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == [0,2,3]

test_input = { "words": ["epnmbry","hhfhprvqba"], "x": "l" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["zst","mjzbdxsks","dza","neqj","oqeilr"], "x": "d" }
assert my_solution.findWordsContaining(**test_input) == [1,2]

test_input = { "words": ["ffruqk","sse","cyj","tntq","mibbhhpce"], "x": "c" }
assert my_solution.findWordsContaining(**test_input) == [2,4]

test_input = { "words": ["vumzrbe","qudq","qfrt"], "x": "u" }
assert my_solution.findWordsContaining(**test_input) == [0,1]

test_input = { "words": ["wcrrprvu","fizkw","vzcjxhjy","e"], "x": "r" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["gjk","vri"], "x": "n" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["fds","vbmg","p","iesyvc","wgmyxhoo","yfllvzr"], "x": "f" }
assert my_solution.findWordsContaining(**test_input) == [0,5]

test_input = { "words": ["mifbjo","kpjlwfbas","skhueysodn","zeewicisy"], "x": "g" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["pvkmoccv","j"], "x": "y" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["s","uhcfwsssbe","iwofeukmx","yfta","ovrdcb","psnje"], "x": "s" }
assert my_solution.findWordsContaining(**test_input) == [0,1,5]

test_input = { "words": ["klpzrjw","qmrhbpa"], "x": "v" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["fzegksjmw","masiwhjue","gngsht","xwvmp","aahn","dwxr"], "x": "c" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["mveahpesx","tsqds","g","mux","bivffitjx","zfsqdje"], "x": "f" }
assert my_solution.findWordsContaining(**test_input) == [4,5]

test_input = { "words": ["c"], "x": "a" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["jzmhnhqkq"], "x": "a" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["cfdgbc","ltpvko","batjenrlq","edwefhw"], "x": "t" }
assert my_solution.findWordsContaining(**test_input) == [1,2]

test_input = { "words": ["smlcojfydr","slb"], "x": "r" }
assert my_solution.findWordsContaining(**test_input) == [0]

test_input = { "words": ["lnjimir"], "x": "x" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["do"], "x": "e" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["xyyvbxsb","dc","mmqpb","mmbwv","wdreyof","kpk","reeb"], "x": "l" }
assert my_solution.findWordsContaining(**test_input) == []

test_input = { "words": ["ytvyknnmzv","jsoe","wctzk"], "x": "i" }
assert my_solution.findWordsContaining(**test_input) == []


maximize-area-of-square-hole-in-grid

Maximize Area of Square Hole in Grid

Prompt:
"""
给你一个网格图，由n + 2条 横线段和m + 2条竖线段组成，一开始所有区域均为1 x 1的单元格。
所有线段的编号从 1开始。
给你两个整数n 和m。
同时给你两个整数数组hBars 和vBars。

hBars 包含区间[2, n + 1]内互不相同的横线段编号。
vBars包含[2, m + 1]内互不相同的竖线段编号。

如果满足以下条件之一，你可以 移除两个数组中的部分线段：

如果移除的是横线段，它必须是hBars中的值。
如果移除的是竖线段，它必须是vBars中的值。

请你返回移除一些线段后（可能不移除任何线段），剩余网格图中 最大正方形空洞的面积，正方形空洞的意思是正方形 内部 不含有任何线段。

示例 1：

输入：n = 2, m = 1, hBars = [2,3], vBars = [2]
输出：4
解释：左边的图是一开始的网格图。
横线编号的范围是区间 [1,4] ，竖线编号的范围是区间 [1,3] 。
可以移除的横线段为 [2,3] ，竖线段为 [2] 。
一种得到最大正方形面积的方法是移除横线段 2 和竖线段 2 。
操作后得到的网格图如右图所示。
正方形空洞面积为 4。
无法得到面积大于 4 的正方形空洞。
所以答案为 4 。

示例 2：

输入：n = 1, m = 1, hBars = [2], vBars = [2]
输出：4
解释：左边的图是一开始的网格图。
横线编号的范围是区间 [1,3] ，竖线编号的范围是区间 [1,3] 。
可以移除的横线段为 [2] ，竖线段为 [2] 。
一种得到最大正方形面积的方法是移除横线段 2 和竖线段 2 。
操作后得到的网格图如右图所示。
正方形空洞面积为 4。
无法得到面积大于 4 的正方形空洞。
所以答案为 4 。

示例 3：

输入：n = 2, m = 3, hBars = [2,3], vBars = [2,3,4]
输出：9
解释：左边的图是一开始的网格图。
横线编号的范围是区间 [1,4] ，竖线编号的范围是区间 [1,5] 。
可以移除的横线段为 [2,3] ，竖线段为 [2,3,4] 。
一种得到最大正方形面积的方法是移除横线段 2、3 和竖线段 3、4 。
操作后得到的网格图如右图所示。
正方形空洞面积为 9。
无法得到面积大于 9 的正方形空洞。
所以答案为 9 。

提示：

1 <= n <= 109
1 <= m <= 109
1 <= hBars.length <= 100
2 <= hBars[i] <= n + 1
1 <= vBars.length <= 100
2 <= vBars[i] <= m + 1
hBars中的值互不相同。
vBars 中的值互不相同。
"""
class Solution:
    def maximizeSquareHoleArea(self, n: int, m: int, hBars: List[int], vBars: List[int]) -> int:

给你一个网格图，由n + 2条 横线段和m + 2条竖线段组成，一开始所有区域均为1 x 1的单元格。
所有线段的编号从 1开始。
给你两个整数n 和m。
同时给你两个整数数组hBars 和vBars。

hBars 包含区间[2, n + 1]内互不相同的横线段编号。
vBars包含[2, m + 1]内互不相同的竖线段编号。

如果满足以下条件之一，你可以 移除两个数组中的部分线段：

如果移除的是横线段，它必须是hBars中的值。
如果移除的是竖线段，它必须是vBars中的值。

请你返回移除一些线段后（可能不移除任何线段），剩余网格图中 最大正方形空洞的面积，正方形空洞的意思是正方形 内部 不含有任何线段。

示例 1：

输入：n = 2, m = 1, hBars = [2,3], vBars = [2]
输出：4
解释：左边的图是一开始的网格图。
横线编号的范围是区间 [1,4] ，竖线编号的范围是区间 [1,3] 。
可以移除的横线段为 [2,3] ，竖线段为 [2] 。
一种得到最大正方形面积的方法是移除横线段 2 和竖线段 2 。
操作后得到的网格图如右图所示。
正方形空洞面积为 4。
无法得到面积大于 4 的正方形空洞。
所以答案为 4 。

示例 2：

输入：n = 1, m = 1, hBars = [2], vBars = [2]
输出：4
解释：左边的图是一开始的网格图。
横线编号的范围是区间 [1,3] ，竖线编号的范围是区间 [1,3] 。
可以移除的横线段为 [2] ，竖线段为 [2] 。
一种得到最大正方形面积的方法是移除横线段 2 和竖线段 2 。
操作后得到的网格图如右图所示。
正方形空洞面积为 4。
无法得到面积大于 4 的正方形空洞。
所以答案为 4 。

示例 3：

输入：n = 2, m = 3, hBars = [2,3], vBars = [2,3,4]
输出：9
解释：左边的图是一开始的网格图。
横线编号的范围是区间 [1,4] ，竖线编号的范围是区间 [1,5] 。
可以移除的横线段为 [2,3] ，竖线段为 [2,3,4] 。
一种得到最大正方形面积的方法是移除横线段 2、3 和竖线段 3、4 。
操作后得到的网格图如右图所示。
正方形空洞面积为 9。
无法得到面积大于 9 的正方形空洞。
所以答案为 9 。

提示：

1 <= n <= 109
1 <= m <= 109
1 <= hBars.length <= 100
2 <= hBars[i] <= n + 1
1 <= vBars.length <= 100
2 <= vBars[i] <= m + 1
hBars中的值互不相同。
vBars 中的值互不相同。

请完成下面的代码来解决上述问题:
```python
class Solution:
    def maximizeSquareHoleArea(self, n: int, m: int, hBars: List[int], vBars: List[int]) -> int:

```

my_solution = Solution()

test_input = { "n": 2, "m": 1, "hBars": [2,3], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 1, "hBars": [2], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 3, "hBars": [2,3], "vBars": [2,3,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 1, "m": 5, "hBars": [2], "vBars": [2,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 4, "hBars": [3,2], "vBars": [4,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 4, "hBars": [2], "vBars": [2,3,5,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 4, "hBars": [2], "vBars": [4,3,2,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 3, "m": 2, "hBars": [3,2,4], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 3, "m": 2, "hBars": [4,2,3], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 14, "m": 4, "hBars": [13], "vBars": [3,4,5,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 19, "m": 7, "hBars": [6,12,4], "vBars": [6,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 4, "hBars": [2,3], "vBars": [4,2,3,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 4, "m": 2, "hBars": [2,5,4,3], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 5, "m": 1, "hBars": [2,4,3,6,5], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 6, "hBars": [2], "vBars": [3,2,7,4,6,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 13, "hBars": [2], "vBars": [4,14,2,12,11,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 5, "hBars": [2,3], "vBars": [6,2,5,4,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 5, "m": 2, "hBars": [2,3,6,4,5], "vBars": [2,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 6, "m": 1, "hBars": [7,4,3,2,5,6], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 4, "m": 4, "hBars": [2,3,4,5], "vBars": [5,4,3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 4, "m": 4, "hBars": [3,4,2,5], "vBars": [2,5,3,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 6, "m": 2, "hBars": [7,3,5,4,6,2], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 7, "m": 11, "hBars": [7,4,5,2,8,6,3], "vBars": [4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 8, "hBars": [2], "vBars": [9,7,8,2,5,6,4,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 9, "hBars": [2], "vBars": [5,2,10,4,3,6,8,7] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 7, "hBars": [2,3], "vBars": [2,5,6,8,7,3,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 2, "m": 7, "hBars": [2,3], "vBars": [2,8,6,7,5,3,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 4, "m": 5, "hBars": [3,2,4,5], "vBars": [4,3,6,5,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 4, "m": 5, "hBars": [5,3,4,2], "vBars": [5,3,6,4,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 4, "m": 40, "hBars": [5,3,2,4], "vBars": [36,41,6,34,33] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 8, "m": 1, "hBars": [4,7,9,8,6,2,3,5], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 11, "m": 6, "hBars": [8,9,6], "vBars": [5,3,6,4,2,7] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 22, "m": 50, "hBars": [6,19,8,17,23], "vBars": [51,3,32,44] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 27, "m": 2, "hBars": [2,26,28,22,4,8,23], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 1, "m": 9, "hBars": [2], "vBars": [3,6,10,4,8,5,9,7,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 9, "hBars": [2], "vBars": [3,7,5,9,10,2,4,8,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 3, "m": 7, "hBars": [2,4,3], "vBars": [5,4,2,3,7,6,8] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 3, "m": 7, "hBars": [4,3,2], "vBars": [2,7,3,6,5,4,8] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 3, "m": 7, "hBars": [4,3,2], "vBars": [3,7,5,2,6,4,8] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 3, "m": 7, "hBars": [4,3,2], "vBars": [8,2,5,3,6,4,7] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 3, "m": 13, "hBars": [2,4,3], "vBars": [4,6,7,12,10,13,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 4, "m": 6, "hBars": [2,3,4,5], "vBars": [7,2,4,6,3,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 5, "m": 5, "hBars": [4,6,5,2,3], "vBars": [2,4,5,6,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 7, "m": 3, "hBars": [8,6,4,5,7,2,3], "vBars": [4,3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 8, "m": 2, "hBars": [4,2,6,8,7,5,3,9], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 9, "m": 1, "hBars": [2,9,3,10,4,6,7,8,5], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 9, "m": 1, "hBars": [9,5,4,8,7,10,3,2,6], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 12, "m": 5, "hBars": [10,9,13,6,3], "vBars": [3,4,2,5,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 29, "m": 2, "hBars": [25,14,11,29,7,10,16,8], "vBars": [2,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 1, "m": 10, "hBars": [2], "vBars": [3,4,6,8,5,7,9,10,11,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 10, "hBars": [2], "vBars": [10,6,5,7,4,3,11,8,9,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 9, "hBars": [2,3], "vBars": [6,7,9,3,10,2,5,4,8] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 2, "m": 9, "hBars": [3,2], "vBars": [4,8,2,6,7,3,5,9,10] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 4, "m": 7, "hBars": [5,4,3,2], "vBars": [8,7,5,2,4,3,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 5, "m": 6, "hBars": [2,6,5,3,4], "vBars": [4,2,5,3,7,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 5, "m": 6, "hBars": [5,3,6,2,4], "vBars": [5,7,2,4,3,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 5, "m": 6, "hBars": [6,4,3,5,2], "vBars": [2,4,5,7,6,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 5, "m": 11, "hBars": [4,2,6,3,5], "vBars": [8,11,10,12,6,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 6, "m": 5, "hBars": [4,5,3,2,7,6], "vBars": [6,3,5,4,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 6, "m": 5, "hBars": [5,2,3,7,4,6], "vBars": [6,2,4,3,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 6, "m": 5, "hBars": [6,3,4,2,7,5], "vBars": [2,5,4,3,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 6, "m": 5, "hBars": [7,2,3,4,5,6], "vBars": [6,5,4,2,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 8, "m": 3, "hBars": [4,6,9,3,8,2,7,5], "vBars": [2,4,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 8, "m": 3, "hBars": [5,6,9,3,2,4,8,7], "vBars": [2,4,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 8, "m": 3, "hBars": [8,6,4,3,7,2,9,5], "vBars": [4,2,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 8, "m": 3, "hBars": [9,2,7,6,8,3,4,5], "vBars": [4,2,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 9, "m": 2, "hBars": [5,4,6,8,9,10,2,3,7], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 9, "m": 2, "hBars": [6,3,5,4,8,9,2,10,7], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 10, "m": 1, "hBars": [4,3,10,2,11,5,6,9,8,7], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 11, "hBars": [2], "vBars": [7,12,6,3,4,9,5,10,11,2,8] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 10, "hBars": [2,3], "vBars": [11,10,2,8,7,5,6,9,3,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 4, "m": 8, "hBars": [5,2,3,4], "vBars": [8,7,5,9,4,2,3,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 5, "m": 7, "hBars": [2,3,6,4,5], "vBars": [6,8,4,5,3,7,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 6, "m": 10, "hBars": [2,4,3,6,5,7], "vBars": [11,3,9,6,10,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 10, "m": 2, "hBars": [8,5,4,3,10,2,11,9,6,7], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 11, "m": 1, "hBars": [2,6,9,7,5,11,3,10,4,12,8], "vBars": [2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 44, "m": 2, "hBars": [5,16,18,28,3,9,6,35,14,10], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 1, "m": 12, "hBars": [2], "vBars": [12,9,3,13,7,2,6,11,10,8,4,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 11, "hBars": [2,3], "vBars": [3,7,2,5,12,9,10,4,8,11,6] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 2, "m": 11, "hBars": [2,3], "vBars": [12,10,6,7,2,3,5,11,4,8,9] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 5, "m": 8, "hBars": [2,4,6,3,5], "vBars": [8,7,9,4,2,5,6,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 6, "m": 7, "hBars": [5,4,6,3,2,7], "vBars": [4,7,6,5,2,8,3] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 49

test_input = { "n": 6, "m": 7, "hBars": [6,3,2,7,4,5], "vBars": [6,7,5,2,3,4,8] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 49

test_input = { "n": 8, "m": 5, "hBars": [7,4,3,9,2,8,6,5], "vBars": [5,2,6,3,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 9, "m": 4, "hBars": [4,5,6,10,7,2,3,9,8], "vBars": [5,3,2,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 9, "m": 4, "hBars": [9,6,3,10,2,8,4,5,7], "vBars": [4,3,2,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 10, "m": 3, "hBars": [5,4,9,8,3,6,11,2,10,7], "vBars": [4,3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16

test_input = { "n": 10, "m": 6, "hBars": [6,2,8,3,11,9,10,7,4,5], "vBars": [6,2,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 11, "m": 2, "hBars": [8,12,9,3,5,2,10,6,7,4,11], "vBars": [3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 28, "m": 31, "hBars": [29,24,4], "vBars": [22,24,2,14,26,4,29,13,15,25] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 1, "m": 13, "hBars": [2], "vBars": [9,5,2,6,8,11,7,10,3,13,14,4,12] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 4

test_input = { "n": 2, "m": 12, "hBars": [3,2], "vBars": [13,2,7,4,12,9,10,3,6,5,8,11] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 2, "m": 12, "hBars": [3,2], "vBars": [13,4,7,8,3,2,11,12,5,9,6,10] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 9

test_input = { "n": 5, "m": 9, "hBars": [2,5,6,3,4], "vBars": [2,7,3,9,4,10,8,6,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 6, "m": 9, "hBars": [4,2,5,7,6,3], "vBars": [4,2,6,8,10,3,7,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 49

test_input = { "n": 8, "m": 6, "hBars": [4,8,6,7,2,9,3,5], "vBars": [4,7,6,3,2,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 49

test_input = { "n": 9, "m": 5, "hBars": [2,5,4,8,3,7,6,10,9], "vBars": [6,3,5,2,4] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 9, "m": 5, "hBars": [8,9,5,2,6,7,4,10,3], "vBars": [6,2,3,4,5] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 36

test_input = { "n": 10, "m": 4, "hBars": [4,8,6,3,10,2,7,9,5,11], "vBars": [5,4,3,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 25

test_input = { "n": 11, "m": 3, "hBars": [2,8,5,3,12,10,4,11,6,7,9], "vBars": [3,4,2] }
assert my_solution.maximizeSquareHoleArea(**test_input) == 16


minimum-number-of-coins-for-fruits

Minimum Number of Coins for Fruits

Prompt:
"""
你在一个水果超市里，货架上摆满了玲琅满目的奇珍异果。
给你一个下标从 1开始的数组prices，其中prices[i]表示你购买第 i个水果需要花费的金币数目。
水果超市有如下促销活动：

如果你花费 price[i]购买了水果i，那么接下来的 i个水果你都可以免费获得。

注意，即使你可以免费获得水果j，你仍然可以花费prices[j]个金币去购买它以便能免费获得接下来的 j个水果。
请你返回获得所有水果所需要的 最少金币数。

示例 1：

输入：prices = [3,1,2]
输出：4
解释：你可以按如下方法获得所有水果：
- 花 3 个金币购买水果 1 ，然后免费获得水果 2 。
- 花 1 个金币购买水果 2 ，然后免费获得水果 3 。
- 免费获得水果 3 。
注意，虽然你可以免费获得水果 2 ，但你还是花 1 个金币去购买它，因为这样的总花费最少。
购买所有水果需要最少花费 4 个金币。

示例 2：

输入：prices = [1,10,1,1]
输出：2
解释：你可以按如下方法获得所有水果：
- 花 1 个金币购买水果 1 ，然后免费获得水果 2 。
- 免费获得水果 2 。
- 花 1 个金币购买水果 3 ，然后免费获得水果 4 。
- 免费获得水果 4 。
购买所有水果需要最少花费 2 个金币。

提示：

1 <= prices.length <= 1000
1 <= prices[i] <= 105
"""
class Solution:
    def minimumCoins(self, prices: List[int]) -> int:

你在一个水果超市里，货架上摆满了玲琅满目的奇珍异果。
给你一个下标从 1开始的数组prices，其中prices[i]表示你购买第 i个水果需要花费的金币数目。
水果超市有如下促销活动：

如果你花费 price[i]购买了水果i，那么接下来的 i个水果你都可以免费获得。

注意，即使你可以免费获得水果j，你仍然可以花费prices[j]个金币去购买它以便能免费获得接下来的 j个水果。
请你返回获得所有水果所需要的 最少金币数。

示例 1：

输入：prices = [3,1,2]
输出：4
解释：你可以按如下方法获得所有水果：
- 花 3 个金币购买水果 1 ，然后免费获得水果 2 。
- 花 1 个金币购买水果 2 ，然后免费获得水果 3 。
- 免费获得水果 3 。
注意，虽然你可以免费获得水果 2 ，但你还是花 1 个金币去购买它，因为这样的总花费最少。
购买所有水果需要最少花费 4 个金币。

示例 2：

输入：prices = [1,10,1,1]
输出：2
解释：你可以按如下方法获得所有水果：
- 花 1 个金币购买水果 1 ，然后免费获得水果 2 。
- 免费获得水果 2 。
- 花 1 个金币购买水果 3 ，然后免费获得水果 4 。
- 免费获得水果 4 。
购买所有水果需要最少花费 2 个金币。

提示：

1 <= prices.length <= 1000
1 <= prices[i] <= 105

请完成下面的代码来解决上述问题:
```python
class Solution:
    def minimumCoins(self, prices: List[int]) -> int:

```

my_solution = Solution()

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

test_input = { "prices": [1,10,1,1] }
assert my_solution.minimumCoins(**test_input) == 2

test_input = { "prices": [26,18,6,12,49,7,45,45] }
assert my_solution.minimumCoins(**test_input) == 39

test_input = { "prices": [27,17,29,45,3,39,42,26] }
assert my_solution.minimumCoins(**test_input) == 47

test_input = { "prices": [14,37,37,38,24,15,12] }
assert my_solution.minimumCoins(**test_input) == 63

test_input = { "prices": [1,37,19,38,11,42,18,33,6,37,15,48,23,12,41,18,27,32] }
assert my_solution.minimumCoins(**test_input) == 37

test_input = { "prices": [38,23,27,32,47,45,48,24,39,26,37,42,24,45,27,26,15,16,26,6] }
assert my_solution.minimumCoins(**test_input) == 132

test_input = { "prices": [45,44,5,9,22,14,29,14,21,13,45,10,2,16,14,30,26,1,49] }
assert my_solution.minimumCoins(**test_input) == 66

test_input = { "prices": [37,42,6,50,50,38,30,38,1,13,25,39,18,1,35,32,12] }
assert my_solution.minimumCoins(**test_input) == 74

test_input = { "prices": [17,32,11,25,22] }
assert my_solution.minimumCoins(**test_input) == 28

test_input = { "prices": [18,10,1,11,6,30,19,24,1,18,37,29,28,27,38] }
assert my_solution.minimumCoins(**test_input) == 26

test_input = { "prices": [3,10,25,47,49,10,49] }
assert my_solution.minimumCoins(**test_input) == 38

test_input = { "prices": [46,7,15] }
assert my_solution.minimumCoins(**test_input) == 53

test_input = { "prices": [16,45,25,5,18,19,25,13,33] }
assert my_solution.minimumCoins(**test_input) == 59

test_input = { "prices": [21,16,7,10,30] }
assert my_solution.minimumCoins(**test_input) == 28

test_input = { "prices": [21,22,29,37,23,15,39,9,19,10,6,9,33,28,43] }
assert my_solution.minimumCoins(**test_input) == 71

test_input = { "prices": [37,16,42,47,16,31,39,8,26,50,33] }
assert my_solution.minimumCoins(**test_input) == 77

test_input = { "prices": [32,4] }
assert my_solution.minimumCoins(**test_input) == 32

test_input = { "prices": [31,9,2,36,4,45,28,28,12,22,44,17,10,48,15,22,7,14,41] }
assert my_solution.minimumCoins(**test_input) == 56

test_input = { "prices": [1,31,9,36,44,2,23] }
assert my_solution.minimumCoins(**test_input) == 12

test_input = { "prices": [3,7,2,36,33,7,21,40,19] }
assert my_solution.minimumCoins(**test_input) == 12

test_input = { "prices": [9,4,7,29,22,50] }
assert my_solution.minimumCoins(**test_input) == 16

test_input = { "prices": [28,2,40,15] }
assert my_solution.minimumCoins(**test_input) == 30

test_input = { "prices": [16,17,47,20,18,37] }
assert my_solution.minimumCoins(**test_input) == 51

test_input = { "prices": [42,6,44,47,11,6,30,38,41,43,46,35,28,4,47,1,7,35] }
assert my_solution.minimumCoins(**test_input) == 93

test_input = { "prices": [10,10,5,8,5,13,34,31,36] }
assert my_solution.minimumCoins(**test_input) == 20

test_input = { "prices": [12,20,14,46,22,1,42,50,47,47,38,37,13] }
assert my_solution.minimumCoins(**test_input) == 40

test_input = { "prices": [1,38,28,46,18,22,12,7,44,44,40,36,41,5,33,5,30,33,31] }
assert my_solution.minimumCoins(**test_input) == 46

test_input = { "prices": [6,45,2,29,44,14,44] }
assert my_solution.minimumCoins(**test_input) == 22

test_input = { "prices": [34,13,50,42,24,47,41,8,26,34,3,48,39,24,39,26,46] }
assert my_solution.minimumCoins(**test_input) == 74

test_input = { "prices": [47,9,33,6,33,40,28,37,49,39,45,14,13,40,17,14,39,12,15,6] }
assert my_solution.minimumCoins(**test_input) == 103

test_input = { "prices": [32] }
assert my_solution.minimumCoins(**test_input) == 32

test_input = { "prices": [35,46,50,35,11,14,44,17,45,23,34,33,8,27,19,7,10,12,14] }
assert my_solution.minimumCoins(**test_input) == 107

test_input = { "prices": [50,45,14,24,18,15,9,14] }
assert my_solution.minimumCoins(**test_input) == 73

test_input = { "prices": [38,19,18,15,20,43,18,9,44,26,29] }
assert my_solution.minimumCoins(**test_input) == 74

test_input = { "prices": [26,21,7,40,37,44,13,3,10,9,15,12,30,18,31,10,23] }
assert my_solution.minimumCoins(**test_input) == 55

test_input = { "prices": [36,50] }
assert my_solution.minimumCoins(**test_input) == 36

test_input = { "prices": [1,32,48,36,26,5,30,25,2,17,26,39,17,46,34,47,43,45,20,48] }
assert my_solution.minimumCoins(**test_input) == 71

test_input = { "prices": [19,24,31,24] }
assert my_solution.minimumCoins(**test_input) == 43

test_input = { "prices": [1,18,25,29,17,9,3,29,23,17,18] }
assert my_solution.minimumCoins(**test_input) == 29

test_input = { "prices": [18,36,18,44,30,8,42,33,45,19,50,19,24,48] }
assert my_solution.minimumCoins(**test_input) == 63

test_input = { "prices": [26,25,47,36,9,31,1,29,29,42,29,42,36,19,45,4,11,7] }
assert my_solution.minimumCoins(**test_input) == 80

test_input = { "prices": [24,34,47,12,24,48,14,30,28,43,35,45,11,11,35,38] }
assert my_solution.minimumCoins(**test_input) == 95

test_input = { "prices": [29,18,2,6,47,32,27,12,38,17] }
assert my_solution.minimumCoins(**test_input) == 49

test_input = { "prices": [3,31,15,18,47,18,2,27,24,6,36,35,41,21,30] }
assert my_solution.minimumCoins(**test_input) == 26

test_input = { "prices": [29,45,8,45,23,35] }
assert my_solution.minimumCoins(**test_input) == 37

test_input = { "prices": [39,37] }
assert my_solution.minimumCoins(**test_input) == 39

test_input = { "prices": [18,45,6,14,41,41] }
assert my_solution.minimumCoins(**test_input) == 24

test_input = { "prices": [50,21,38,2,32,49,32,40,41,34,33,40,36,16,29,34,42,40,46] }
assert my_solution.minimumCoins(**test_input) == 121

test_input = { "prices": [28,17,42,20,6,26,47,6,23] }
assert my_solution.minimumCoins(**test_input) == 51

test_input = { "prices": [37,27,17,40,50,35,16,4,28,5,27,13,46,7,23,27] }
assert my_solution.minimumCoins(**test_input) == 74

test_input = { "prices": [11,5,40,16,20,38] }
assert my_solution.minimumCoins(**test_input) == 32

test_input = { "prices": [16,27,5,38,12,24,7,49,40,13,38,13,34,38,37,2,4,44] }
assert my_solution.minimumCoins(**test_input) == 41

test_input = { "prices": [25,9,49,19,33] }
assert my_solution.minimumCoins(**test_input) == 53

test_input = { "prices": [47,23,46,13,26,44,43,22,43,24,13,20,6,16,8,26] }
assert my_solution.minimumCoins(**test_input) == 105

test_input = { "prices": [8,1,1] }
assert my_solution.minimumCoins(**test_input) == 9

test_input = { "prices": [47,45,2,25,7,46] }
assert my_solution.minimumCoins(**test_input) == 49

test_input = { "prices": [4,31,50,45,5,50] }
assert my_solution.minimumCoins(**test_input) == 40

test_input = { "prices": [30,41,1,49,9,49,41,27,41,14,23,3,46,40,37,28,45,19,36,49] }
assert my_solution.minimumCoins(**test_input) == 54

test_input = { "prices": [6,3,49,28,31,36,5,50,39] }
assert my_solution.minimumCoins(**test_input) == 40

test_input = { "prices": [37,2,19,36,26,27,3,23,10,20,33,8,39,6,28] }
assert my_solution.minimumCoins(**test_input) == 65

test_input = { "prices": [37,34,12,30,43,35,6,21,47,38,14,31,49,11,14] }
assert my_solution.minimumCoins(**test_input) == 66

test_input = { "prices": [49,6,12,35,17,17,2] }
assert my_solution.minimumCoins(**test_input) == 63

test_input = { "prices": [45,27,43,34,41,30,28,45,24,50,20,4,15,42] }
assert my_solution.minimumCoins(**test_input) == 116

test_input = { "prices": [48,22,36] }
assert my_solution.minimumCoins(**test_input) == 70

test_input = { "prices": [47,13,23,31,41,25] }
assert my_solution.minimumCoins(**test_input) == 70

test_input = { "prices": [3,44,17,37,9,14,37] }
assert my_solution.minimumCoins(**test_input) == 29

test_input = { "prices": [4,43,7,15,38] }
assert my_solution.minimumCoins(**test_input) == 11

test_input = { "prices": [10,25,7,37,6,43,4,50,9,14,36,35,36,44,17,10,44,46,50] }
assert my_solution.minimumCoins(**test_input) == 35

test_input = { "prices": [45,28,10,18,18,3,42,24,14,11,13,32,37,31,50,32] }
assert my_solution.minimumCoins(**test_input) == 69

test_input = { "prices": [12,38,44,24,42,9,32,40,8,20,46,39,33] }
assert my_solution.minimumCoins(**test_input) == 73

test_input = { "prices": [5,42,30,20,37,26,38,30,30,32,39,31,33,41,23,4,29] }
assert my_solution.minimumCoins(**test_input) == 85

test_input = { "prices": [44,22] }
assert my_solution.minimumCoins(**test_input) == 44

test_input = { "prices": [8,8,11,21,9] }
assert my_solution.minimumCoins(**test_input) == 19

test_input = { "prices": [2,37,19,30,37,27,10,37] }
assert my_solution.minimumCoins(**test_input) == 31

test_input = { "prices": [43,27,48,22] }
assert my_solution.minimumCoins(**test_input) == 70

test_input = { "prices": [50,23,37,49,45,14,18,39,50,7,31] }
assert my_solution.minimumCoins(**test_input) == 101

test_input = { "prices": [37,3,32,25,21,22,26,49,14,45,1,36] }
assert my_solution.minimumCoins(**test_input) == 62

test_input = { "prices": [21,29,31,28,2,41,4,43,41,16,38,33,3,6,43,22,15] }
assert my_solution.minimumCoins(**test_input) == 59

test_input = { "prices": [24,47,32,41,35,14,18,23,27,8,27] }
assert my_solution.minimumCoins(**test_input) == 70

test_input = { "prices": [40,25,32] }
assert my_solution.minimumCoins(**test_input) == 65

test_input = { "prices": [9,18,2,26,15,3,2,33,46,6,11,34,27,7,5,7,26,13,48] }
assert my_solution.minimumCoins(**test_input) == 18

test_input = { "prices": [41,8,38,32,36,30,23,49,40,46,42,34,2,12,12,19,20,50,40] }
assert my_solution.minimumCoins(**test_input) == 104

test_input = { "prices": [28,8,24,14,34,36,48] }
assert my_solution.minimumCoins(**test_input) == 50

test_input = { "prices": [2,36,22,41,42,26,1,48,14,27,22,26] }
assert my_solution.minimumCoins(**test_input) == 25

test_input = { "prices": [25,39,21,21,16] }
assert my_solution.minimumCoins(**test_input) == 46

test_input = { "prices": [44,41,36,42,21,32,45,5] }
assert my_solution.minimumCoins(**test_input) == 101

test_input = { "prices": [10] }
assert my_solution.minimumCoins(**test_input) == 10

test_input = { "prices": [35,29] }
assert my_solution.minimumCoins(**test_input) == 35

test_input = { "prices": [38,35,33,11,43,33] }
assert my_solution.minimumCoins(**test_input) == 71

test_input = { "prices": [19,29,49,20,8,12,13,28,45,9,12,3,1,17,35] }
assert my_solution.minimumCoins(**test_input) == 65

test_input = { "prices": [34,22,1,41,34,27,18] }
assert my_solution.minimumCoins(**test_input) == 53

test_input = { "prices": [31,9,39,6,14,32,28,35,34,42,19,41,35,24,32,16,12,49,16] }
assert my_solution.minimumCoins(**test_input) == 73

test_input = { "prices": [46,50,21,14,26,47] }
assert my_solution.minimumCoins(**test_input) == 67

test_input = { "prices": [5,22,36,6,15,49,20,16,36,15,32,27,50,19,12,22,9,33] }
assert my_solution.minimumCoins(**test_input) == 57

test_input = { "prices": [17,4,36,4,32,11,42,12,20] }
assert my_solution.minimumCoins(**test_input) == 36

test_input = { "prices": [48,33,39,1,13,40] }
assert my_solution.minimumCoins(**test_input) == 82

test_input = { "prices": [32,19,33,30,32,44,47,8,10,1,23,6,28,19,20,48,12,10,20,22] }
assert my_solution.minimumCoins(**test_input) == 84

test_input = { "prices": [29,5,46,34,38,7,1,15] }
assert my_solution.minimumCoins(**test_input) == 68

test_input = { "prices": [39,50,22,1,38,22,49,16,27,48,45,28,43,34] }
assert my_solution.minimumCoins(**test_input) == 78


find-maximum-non-decreasing-array-length

Find Maximum Non-decreasing Array Length

Prompt:
"""
给你一个下标从 0开始的整数数组nums。
你可以执行任意次操作。每次操作中，你需要选择一个 子数组，并将这个子数组用它所包含元素的 和替换。比方说，给定数组是[1,3,5,6]，你可以选择子数组[3,5]，用子数组的和 8替换掉子数组，然后数组会变为[1,8,6]。
请你返回执行任意次操作以后，可以得到的 最长非递减数组的长度。
子数组指的是一个数组中一段连续 非空的元素序列。

示例 1：

输入：nums = [5,2,2]
输出：1
解释：这个长度为 3 的数组不是非递减的。
我们有 2 种方案使数组长度为 2 。
第一种，选择子数组 [2,2] ，对数组执行操作后得到 [5,4] 。
第二种，选择子数组 [5,2] ，对数组执行操作后得到 [7,2] 。
这两种方案中，数组最后都不是 非递减的，所以不是可行的答案。
如果我们选择子数组 [5,2,2] ，并将它替换为 [9] ，数组变成非递减的。
所以答案为 1 。

示例 2：

输入：nums = [1,2,3,4]
输出：4
解释：数组已经是非递减的。所以答案为 4 。

示例 3：

输入：nums = [4,3,2,6]
输出：3
解释：将 [3,2] 替换为 [5] ，得到数组 [4,5,6] ，它是非递减的。
最大可能的答案为 3 。

提示：

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

给你一个下标从 0开始的整数数组nums。
你可以执行任意次操作。每次操作中，你需要选择一个 子数组，并将这个子数组用它所包含元素的 和替换。比方说，给定数组是[1,3,5,6]，你可以选择子数组[3,5]，用子数组的和 8替换掉子数组，然后数组会变为[1,8,6]。
请你返回执行任意次操作以后，可以得到的 最长非递减数组的长度。
子数组指的是一个数组中一段连续 非空的元素序列。

示例 1：

输入：nums = [5,2,2]
输出：1
解释：这个长度为 3 的数组不是非递减的。
我们有 2 种方案使数组长度为 2 。
第一种，选择子数组 [2,2] ，对数组执行操作后得到 [5,4] 。
第二种，选择子数组 [5,2] ，对数组执行操作后得到 [7,2] 。
这两种方案中，数组最后都不是 非递减的，所以不是可行的答案。
如果我们选择子数组 [5,2,2] ，并将它替换为 [9] ，数组变成非递减的。
所以答案为 1 。

示例 2：

输入：nums = [1,2,3,4]
输出：4
解释：数组已经是非递减的。所以答案为 4 。

示例 3：

输入：nums = [4,3,2,6]
输出：3
解释：将 [3,2] 替换为 [5] ，得到数组 [4,5,6] ，它是非递减的。
最大可能的答案为 3 。

提示：

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

请完成下面的代码来解决上述问题:
```python
class Solution:
    def findMaximumLength(self, nums: List[int]) -> int:

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [29,859] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [48,612] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [76,837] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [103,341] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [171,323] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [248,719] }
assert my_solution.findMaximumLength(**test_input) == 2

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

test_input = { "nums": [274,467] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [351,665] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [372,382] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [404,409] }
assert my_solution.findMaximumLength(**test_input) == 2

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

test_input = { "nums": [472,843] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [504,838] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [549,747] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [570,810] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [621,809] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [643,802] }
assert my_solution.findMaximumLength(**test_input) == 2

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

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

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

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

test_input = { "nums": [773,877] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [776,962] }
assert my_solution.findMaximumLength(**test_input) == 2

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

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

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

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

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

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

test_input = { "nums": [981,998] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [41,340,784] }
assert my_solution.findMaximumLength(**test_input) == 3

test_input = { "nums": [103,652,579] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [116,635,966] }
assert my_solution.findMaximumLength(**test_input) == 3

test_input = { "nums": [137,32,745] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [247,173,316] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [276,315,947] }
assert my_solution.findMaximumLength(**test_input) == 3

test_input = { "nums": [278,754,912] }
assert my_solution.findMaximumLength(**test_input) == 3

test_input = { "nums": [314,882,708] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [371,101,367] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [402,305,990] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [403,553,697] }
assert my_solution.findMaximumLength(**test_input) == 3

test_input = { "nums": [431,780,315] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [479,322,44] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [512,234,679] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [513,847,778] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [525,177,936] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [588,42,18] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [646,174,827] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [680,242,726] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [769,131,241] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [780,591,213] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [783,23,848] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [787,201,30] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [791,470,87] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [797,181,492] }
assert my_solution.findMaximumLength(**test_input) == 1

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

test_input = { "nums": [881,306,316] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [886,116,68] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [893,531,805] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [926,641,145] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [964,624,279] }
assert my_solution.findMaximumLength(**test_input) == 1

test_input = { "nums": [987,694,396] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [38,986,134,156] }
assert my_solution.findMaximumLength(**test_input) == 2

test_input = { "nums": [43,236,417,521] }
assert my_solution.findMaximumLength(**test_input) == 4

test_input = { "nums": [58,890,892,52] }
assert my_solution.findMaximumLength(**test_input) == 3

test_input = { "nums": [81,738,403,654] }
assert my_solution.findMaximumLength(**test_input) == 3


make-three-strings-equal

Make Three Strings Equal

Prompt:
"""
给你三个字符串 s1、s2 和 s3。 你可以根据需要对这三个字符串执行以下操作 任意次数 。
在每次操作中，你可以选择其中一个长度至少为 2 的字符串  并删除其 最右位置上 的字符。
如果存在某种方法能够使这三个字符串相等，请返回使它们相等所需的 最小 操作次数；否则，返回 -1。

示例 1：

输入：s1 = "abc"，s2 = "abb"，s3 = "ab"
输出：2
解释：对 s1 和 s2 进行一次操作后，可以得到三个相等的字符串。
可以证明，不可能用少于两次操作使它们相等。
示例 2：

输入：s1 = "dac"，s2 = "bac"，s3 = "cac"
输出：-1
解释：因为 s1 和 s2 的最左位置上的字母不相等，所以无论进行多少次操作，它们都不可能相等。因此答案是 -1 。

提示：

1 <= s1.length, s2.length, s3.length <= 100
s1、s2 和 s3 仅由小写英文字母组成。
"""
class Solution:
    def findMinimumOperations(self, s1: str, s2: str, s3: str) -> int:

给你三个字符串 s1、s2 和 s3。 你可以根据需要对这三个字符串执行以下操作 任意次数 。
在每次操作中，你可以选择其中一个长度至少为 2 的字符串  并删除其 最右位置上 的字符。
如果存在某种方法能够使这三个字符串相等，请返回使它们相等所需的 最小 操作次数；否则，返回 -1。

示例 1：

输入：s1 = "abc"，s2 = "abb"，s3 = "ab"
输出：2
解释：对 s1 和 s2 进行一次操作后，可以得到三个相等的字符串。
可以证明，不可能用少于两次操作使它们相等。
示例 2：

输入：s1 = "dac"，s2 = "bac"，s3 = "cac"
输出：-1
解释：因为 s1 和 s2 的最左位置上的字母不相等，所以无论进行多少次操作，它们都不可能相等。因此答案是 -1 。

提示：

1 <= s1.length, s2.length, s3.length <= 100
s1、s2 和 s3 仅由小写英文字母组成。

请完成下面的代码来解决上述问题:
```python
class Solution:
    def findMinimumOperations(self, s1: str, s2: str, s3: str) -> int:

```

my_solution = Solution()

test_input = { "s1": "abc", "s2": "abb", "s3": "ab" }
assert my_solution.findMinimumOperations(**test_input) == 2

test_input = { "s1": "dac", "s2": "bac", "s3": "cac" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "a", "s2": "a", "s3": "a" }
assert my_solution.findMinimumOperations(**test_input) == 0

test_input = { "s1": "kui", "s2": "m", "s3": "v" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "a", "s2": "aabc", "s3": "a" }
assert my_solution.findMinimumOperations(**test_input) == 3

test_input = { "s1": "cc", "s2": "cccb", "s3": "c" }
assert my_solution.findMinimumOperations(**test_input) == 4

test_input = { "s1": "luso", "s2": "lu", "s3": "lu" }
assert my_solution.findMinimumOperations(**test_input) == 2

test_input = { "s1": "xx", "s2": "phe", "s3": "xie" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "gzd", "s2": "bcju", "s3": "db" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "cbba", "s2": "cbaa", "s3": "c" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "k", "s2": "kfb", "s3": "krcnf" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "oby", "s2": "obz", "s3": "obf" }
assert my_solution.findMinimumOperations(**test_input) == 3

test_input = { "s1": "b", "s2": "aba", "s3": "aaccaa" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "a", "s2": "accabb", "s3": "aaa" }
assert my_solution.findMinimumOperations(**test_input) == 7

test_input = { "s1": "b", "s2": "bccaaba", "s3": "ba" }
assert my_solution.findMinimumOperations(**test_input) == 7

test_input = { "s1": "b", "s2": "bacccab", "s3": "cc" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "ca", "s2": "cccabb", "s3": "cb" }
assert my_solution.findMinimumOperations(**test_input) == 7

test_input = { "s1": "ccb", "s2": "ccba", "s3": "ccb" }
assert my_solution.findMinimumOperations(**test_input) == 1

test_input = { "s1": "mbooi", "s2": "pdq", "s3": "br" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "xxfzj", "s2": "faho", "s3": "c" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "acbc", "s2": "acba", "s3": "acb" }
assert my_solution.findMinimumOperations(**test_input) == 2

test_input = { "s1": "aduyyk", "s2": "v", "s3": "lpyt" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "xd", "s2": "sl", "s3": "azoeaje" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "bbbaa", "s2": "bacab", "s3": "b" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "cibn", "s2": "ioom", "s3": "bxa" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "bcb", "s2": "bbac", "s3": "cbbc" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "aabbb", "s2": "cc", "s3": "cccb" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "i", "s2": "xqsfy", "s3": "diqae" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "iq", "s2": "iimanmy", "s3": "id" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "pitggt", "s2": "pi", "s3": "pih" }
assert my_solution.findMinimumOperations(**test_input) == 5

test_input = { "s1": "ten", "s2": "ten", "s3": "tenob" }
assert my_solution.findMinimumOperations(**test_input) == 2

test_input = { "s1": "vejy", "s2": "fbqfo", "s3": "gl" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "aca", "s2": "abcc", "s3": "accba" }
assert my_solution.findMinimumOperations(**test_input) == 9

test_input = { "s1": "br", "s2": "br", "s3": "brvhgtou" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "c", "s2": "bcc", "s3": "aacbcaca" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "cab", "s2": "caac", "s3": "cacbb" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "ccab", "s2": "cbbcbb", "s3": "ca" }
assert my_solution.findMinimumOperations(**test_input) == 9

test_input = { "s1": "inuc", "s2": "iwpdfj", "s3": "ib" }
assert my_solution.findMinimumOperations(**test_input) == 9

test_input = { "s1": "jrrpyyc", "s2": "jr", "s3": "jrt" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "l", "s2": "gebqrgnz", "s3": "jkr" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "naynn", "s2": "ax", "s3": "bhdcz" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "rexmx", "s2": "ujmbg", "s3": "gg" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "aacbcb", "s2": "a", "s3": "acaaac" }
assert my_solution.findMinimumOperations(**test_input) == 10

test_input = { "s1": "acbb", "s2": "acbacc", "s3": "acb" }
assert my_solution.findMinimumOperations(**test_input) == 4

test_input = { "s1": "baacbab", "s2": "bcc", "s3": "bca" }
assert my_solution.findMinimumOperations(**test_input) == 10

test_input = { "s1": "bcacbba", "s2": "bca", "s3": "bca" }
assert my_solution.findMinimumOperations(**test_input) == 4

test_input = { "s1": "bcaca", "s2": "bcaba", "s3": "bca" }
assert my_solution.findMinimumOperations(**test_input) == 4

test_input = { "s1": "ba", "s2": "bcbcab", "s3": "bbcbb" }
assert my_solution.findMinimumOperations(**test_input) == 10

test_input = { "s1": "cabc", "s2": "cab", "s3": "cabbac" }
assert my_solution.findMinimumOperations(**test_input) == 4

test_input = { "s1": "bbbbcaac", "s2": "a", "s3": "cbcc" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "gjbtodtym", "s2": "gxp", "s3": "g" }
assert my_solution.findMinimumOperations(**test_input) == 10

test_input = { "s1": "hfkq", "s2": "hfrbvno", "s3": "hf" }
assert my_solution.findMinimumOperations(**test_input) == 7

test_input = { "s1": "hym", "s2": "hl", "s3": "hshxmbbj" }
assert my_solution.findMinimumOperations(**test_input) == 10

test_input = { "s1": "mkdflu", "s2": "mmbn", "s3": "mge" }
assert my_solution.findMinimumOperations(**test_input) == 10

test_input = { "s1": "nvlobl", "s2": "mekbzd", "s3": "s" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "rpa", "s2": "rpaxpoh", "s3": "rpa" }
assert my_solution.findMinimumOperations(**test_input) == 4

test_input = { "s1": "ac", "s2": "aacccccbc", "s3": "acc" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "abb", "s2": "abaac", "s3": "abcaca" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "caa", "s2": "caccaccacb", "s3": "c" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "baccaab", "s2": "cababc", "s3": "a" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "cacbb", "s2": "ca", "s3": "cacbcac" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "cbba", "s2": "cabcabab", "s3": "ca" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "cb", "s2": "cbcbb", "s3": "cbaaabb" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "ccabaa", "s2": "ccabc", "s3": "cca" }
assert my_solution.findMinimumOperations(**test_input) == 5

test_input = { "s1": "ccb", "s2": "ccac", "s3": "cccaaca" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "ccccbb", "s2": "cccc", "s3": "cccc" }
assert my_solution.findMinimumOperations(**test_input) == 2

test_input = { "s1": "cxxq", "s2": "cxx", "s3": "cxxdeqh" }
assert my_solution.findMinimumOperations(**test_input) == 5

test_input = { "s1": "d", "s2": "dffjiulzya", "s3": "dke" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "dogv", "s2": "dofjkhx", "s3": "dog" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "dwefrocz", "s2": "dzz", "s3": "dwn" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "etr", "s2": "ejb", "s3": "etpubpvr" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "f", "s2": "morycy", "s3": "vledqoo" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "ful", "s2": "fular", "s3": "fulvkv" }
assert my_solution.findMinimumOperations(**test_input) == 5

test_input = { "s1": "kzwat", "s2": "ku", "s3": "koftvbd" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "qey", "s2": "qevtkbss", "s3": "qeb" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "saqy", "s2": "hvufcpko", "s3": "xm" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "tllwgcdi", "s2": "t", "s3": "tvham" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "vmwdmadn", "s2": "vmw", "s3": "vmw" }
assert my_solution.findMinimumOperations(**test_input) == 5

test_input = { "s1": "xobwwhu", "s2": "xobb", "s3": "xob" }
assert my_solution.findMinimumOperations(**test_input) == 5

test_input = { "s1": "yptajimiz", "s2": "yp", "s3": "ypr" }
assert my_solution.findMinimumOperations(**test_input) == 8

test_input = { "s1": "z", "s2": "zcrouxlukb", "s3": "zbb" }
assert my_solution.findMinimumOperations(**test_input) == 11

test_input = { "s1": "aaabc", "s2": "aaaa", "s3": "aaaabc" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "aaa", "s2": "aab", "s3": "aabaacaab" }
assert my_solution.findMinimumOperations(**test_input) == 9

test_input = { "s1": "aac", "s2": "aac", "s3": "aacabbbca" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "abaab", "s2": "abaabb", "s3": "abaa" }
assert my_solution.findMinimumOperations(**test_input) == 3

test_input = { "s1": "abcomon", "s2": "gkuneup", "s3": "q" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "acc", "s2": "accacb", "s3": "acbabc" }
assert my_solution.findMinimumOperations(**test_input) == 9

test_input = { "s1": "cca", "s2": "caaab", "s3": "babbacc" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "bccbc", "s2": "bc", "s3": "bcccbcac" }
assert my_solution.findMinimumOperations(**test_input) == 9

test_input = { "s1": "bpp", "s2": "bin", "s3": "bfkbyhubw" }
assert my_solution.findMinimumOperations(**test_input) == 12

test_input = { "s1": "bbsyg", "s2": "blbp", "s3": "brghkr" }
assert my_solution.findMinimumOperations(**test_input) == 12

test_input = { "s1": "bxpvamp", "s2": "bxpv", "s3": "bxpv" }
assert my_solution.findMinimumOperations(**test_input) == 3

test_input = { "s1": "ccbabca", "s2": "cbcbaca", "s3": "c" }
assert my_solution.findMinimumOperations(**test_input) == 12

test_input = { "s1": "accb", "s2": "bbc", "s3": "cbbaccba" }
assert my_solution.findMinimumOperations(**test_input) == -1

test_input = { "s1": "cbccc", "s2": "cbc", "s3": "cbcccba" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "cac", "s2": "ccacc", "s3": "cabacba" }
assert my_solution.findMinimumOperations(**test_input) == 12

test_input = { "s1": "ccb", "s2": "ccbcb", "s3": "ccbccab" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "caacabcbc", "s2": "ccb", "s3": "ccc" }
assert my_solution.findMinimumOperations(**test_input) == 12

test_input = { "s1": "cccabaacc", "s2": "ccc", "s3": "ccc" }
assert my_solution.findMinimumOperations(**test_input) == 6

test_input = { "s1": "ajjdre", "s2": "gsrq", "s3": "eurcj" }
assert my_solution.findMinimumOperations(**test_input) == -1