maximize-the-number-of-partitions-after-operations

Maximize the Number of Partitions After Operations

Prompt:
"""
给你一个下标从 0 开始的字符串s和一个整数k。
你需要执行以下分割操作，直到字符串s变为空：

选择s的最长前缀，该前缀最多包含k个不同字符。
删除这个前缀，并将分割数量加一。如果有剩余字符，它们在s中保持原来的顺序。

执行操作之 前 ，你可以将s中至多一处 下标的对应字符更改为另一个小写英文字母。
在最优选择情形下改变至多一处下标对应字符后，用整数表示并返回操作结束时得到的最大分割数量。

示例 1：

输入：s = "accca", k = 2
输出：3
解释：在此示例中，为了最大化得到的分割数量，可以将 s[2] 改为 'b'。
s 变为 "acbca"。
按照以下方式执行操作，直到 s 变为空：
- 选择最长且至多包含 2 个不同字符的前缀，"acbca"。
- 删除该前缀，s 变为 "bca"。现在分割数量为 1。
- 选择最长且至多包含 2 个不同字符的前缀，"bca"。
- 删除该前缀，s 变为 "a"。现在分割数量为 2。
- 选择最长且至多包含 2 个不同字符的前缀，"a"。
- 删除该前缀，s 变为空。现在分割数量为 3。
因此，答案是 3。
可以证明，分割数量不可能超过 3。
示例 2：

输入：s = "aabaab", k = 3
输出：1
解释：在此示例中，为了最大化得到的分割数量，可以保持 s 不变。
按照以下方式执行操作，直到 s 变为空：
- 选择最长且至多包含 3 个不同字符的前缀，"aabaab"。
- 删除该前缀，s 变为空。现在分割数量为 1。
因此，答案是 1。
可以证明，分割数量不可能超过 1。
示例 3：

输入：s = "xxyz", k = 1
输出：4
解释：在此示例中，为了最大化得到的分割数量，可以将 s[1] 改为 'a'。
s 变为 "xayz"。
按照以下方式执行操作，直到 s 变为空：
- 选择最长且至多包含 1 个不同字符的前缀，"xayz"。
- 删除该前缀，s 变为 "ayz"。现在分割数量为 1。
- 选择最长且至多包含 1 个不同字符的前缀，"ayz"。
- 删除该前缀，s 变为 "yz"，现在分割数量为 2。
- 选择最长且至多包含 1 个不同字符的前缀，"yz"。
- 删除该前缀，s 变为 "z"。现在分割数量为 3。
- 选择最且至多包含 1 个不同字符的前缀，"z"。
- 删除该前缀，s 变为空。现在分割数量为 4。
因此，答案是 4。
可以证明，分割数量不可能超过 4。

提示：

1 <= s.length <= 104
s只包含小写英文字母。
1 <= k <= 26
"""
class Solution:
    def maxPartitionsAfterOperations(self, s: str, k: int) -> int:

给你一个下标从 0 开始的字符串s和一个整数k。
你需要执行以下分割操作，直到字符串s变为空：

选择s的最长前缀，该前缀最多包含k个不同字符。
删除这个前缀，并将分割数量加一。如果有剩余字符，它们在s中保持原来的顺序。

执行操作之 前 ，你可以将s中至多一处 下标的对应字符更改为另一个小写英文字母。
在最优选择情形下改变至多一处下标对应字符后，用整数表示并返回操作结束时得到的最大分割数量。

示例 1：

输入：s = "accca", k = 2
输出：3
解释：在此示例中，为了最大化得到的分割数量，可以将 s[2] 改为 'b'。
s 变为 "acbca"。
按照以下方式执行操作，直到 s 变为空：
- 选择最长且至多包含 2 个不同字符的前缀，"acbca"。
- 删除该前缀，s 变为 "bca"。现在分割数量为 1。
- 选择最长且至多包含 2 个不同字符的前缀，"bca"。
- 删除该前缀，s 变为 "a"。现在分割数量为 2。
- 选择最长且至多包含 2 个不同字符的前缀，"a"。
- 删除该前缀，s 变为空。现在分割数量为 3。
因此，答案是 3。
可以证明，分割数量不可能超过 3。
示例 2：

输入：s = "aabaab", k = 3
输出：1
解释：在此示例中，为了最大化得到的分割数量，可以保持 s 不变。
按照以下方式执行操作，直到 s 变为空：
- 选择最长且至多包含 3 个不同字符的前缀，"aabaab"。
- 删除该前缀，s 变为空。现在分割数量为 1。
因此，答案是 1。
可以证明，分割数量不可能超过 1。
示例 3：

输入：s = "xxyz", k = 1
输出：4
解释：在此示例中，为了最大化得到的分割数量，可以将 s[1] 改为 'a'。
s 变为 "xayz"。
按照以下方式执行操作，直到 s 变为空：
- 选择最长且至多包含 1 个不同字符的前缀，"xayz"。
- 删除该前缀，s 变为 "ayz"。现在分割数量为 1。
- 选择最长且至多包含 1 个不同字符的前缀，"ayz"。
- 删除该前缀，s 变为 "yz"，现在分割数量为 2。
- 选择最长且至多包含 1 个不同字符的前缀，"yz"。
- 删除该前缀，s 变为 "z"。现在分割数量为 3。
- 选择最且至多包含 1 个不同字符的前缀，"z"。
- 删除该前缀，s 变为空。现在分割数量为 4。
因此，答案是 4。
可以证明，分割数量不可能超过 4。

提示：

1 <= s.length <= 104
s只包含小写英文字母。
1 <= k <= 26

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

```

my_solution = Solution()

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

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

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

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

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

test_input = { "s": "h", "k": 17 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

test_input = { "s": "p", "k": 13 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "s": "fjz", "k": 11 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

test_input = { "s": "jxg", "k": 23 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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

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

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

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

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

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

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

test_input = { "s": "toqm", "k": 14 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

test_input = { "s": "yhbo", "k": 9 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "s": "odxttm", "k": 19 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

test_input = { "s": "uxqozq", "k": 11 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "s": "tmdhzhy", "k": 26 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

test_input = { "s": "abhujxlb", "k": 13 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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

test_input = { "s": "adklnsqm", "k": 13 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "s": "vwfyagymtp", "k": 20 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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

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

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

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

test_input = { "s": "yyogqjsswyn", "k": 17 }
assert my_solution.maxPartitionsAfterOperations(**test_input) == 1

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

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


smallest-missing-integer-greater-than-sequential-prefix-sum

Smallest Missing Integer Greater Than Sequential Prefix Sum

Prompt:
"""
给你一个下标从 0开始的整数数组nums。
如果一个前缀nums[0..i]满足对于1 <= j <= i的所有元素都有nums[j] = nums[j - 1] + 1，那么我们称这个前缀是一个 顺序前缀 。特殊情况是，只包含nums[0]的前缀也是一个 顺序前缀 。
请你返回 nums中没有出现过的 最小整数x，满足x大于等于最长 顺序前缀的和。

示例 1：

输入：nums = [1,2,3,2,5]
输出：6
解释：nums 的最长顺序前缀是 [1,2,3] ，和为 6 ，6 不在数组中，所以 6 是大于等于最长顺序前缀和的最小整数。

示例 2：

输入：nums = [3,4,5,1,12,14,13]
输出：15
解释：nums 的最长顺序前缀是 [3,4,5] ，和为 12 ，12、13 和 14 都在数组中，但 15 不在，所以 15 是大于等于最长顺序前缀和的最小整数。

提示：

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

给你一个下标从 0开始的整数数组nums。
如果一个前缀nums[0..i]满足对于1 <= j <= i的所有元素都有nums[j] = nums[j - 1] + 1，那么我们称这个前缀是一个 顺序前缀 。特殊情况是，只包含nums[0]的前缀也是一个 顺序前缀 。
请你返回 nums中没有出现过的 最小整数x，满足x大于等于最长 顺序前缀的和。

示例 1：

输入：nums = [1,2,3,2,5]
输出：6
解释：nums 的最长顺序前缀是 [1,2,3] ，和为 6 ，6 不在数组中，所以 6 是大于等于最长顺序前缀和的最小整数。

示例 2：

输入：nums = [3,4,5,1,12,14,13]
输出：15
解释：nums 的最长顺序前缀是 [3,4,5] ，和为 12 ，12、13 和 14 都在数组中，但 15 不在，所以 15 是大于等于最长顺序前缀和的最小整数。

提示：

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

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

```

my_solution = Solution()

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

test_input = { "nums": [3,4,5,1,12,14,13] }
assert my_solution.missingInteger(**test_input) == 15

test_input = { "nums": [29,30,31,32,33,34,35,36,37] }
assert my_solution.missingInteger(**test_input) == 297

test_input = { "nums": [19,20,21,22] }
assert my_solution.missingInteger(**test_input) == 82

test_input = { "nums": [18,19,20,21,22,23,24,25,26,27,28,9] }
assert my_solution.missingInteger(**test_input) == 253

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

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

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

test_input = { "nums": [11,12,13] }
assert my_solution.missingInteger(**test_input) == 36

test_input = { "nums": [47,48,49,5,3] }
assert my_solution.missingInteger(**test_input) == 144

test_input = { "nums": [23,24,25,4,5,1] }
assert my_solution.missingInteger(**test_input) == 72

test_input = { "nums": [8,9,10,10,7,8] }
assert my_solution.missingInteger(**test_input) == 27

test_input = { "nums": [31,32,33,34,10,8,7,9,7,9,9,5,10,1] }
assert my_solution.missingInteger(**test_input) == 130

test_input = { "nums": [17,18,19,20,21,22,3,7,10,10] }
assert my_solution.missingInteger(**test_input) == 117

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

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

test_input = { "nums": [37,1,2,9,5,8,5,2,9,4] }
assert my_solution.missingInteger(**test_input) == 38

test_input = { "nums": [31,32,33,34,1] }
assert my_solution.missingInteger(**test_input) == 130

test_input = { "nums": [45,46,47,48,49,10,8,1,7,4,10,10,6,6,2] }
assert my_solution.missingInteger(**test_input) == 235

test_input = { "nums": [13,10,7,5,7,10,6,10,2] }
assert my_solution.missingInteger(**test_input) == 14

test_input = { "nums": [32,33,34,35,36,37,38,39,40,41,42,43,44,8,6] }
assert my_solution.missingInteger(**test_input) == 494

test_input = { "nums": [24,8,9] }
assert my_solution.missingInteger(**test_input) == 25

test_input = { "nums": [47,48,49,9,3,8,1,9,2,5,4,5,9] }
assert my_solution.missingInteger(**test_input) == 144

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

test_input = { "nums": [28,29] }
assert my_solution.missingInteger(**test_input) == 57

test_input = { "nums": [40,41,42,3,8,2,7,1,4] }
assert my_solution.missingInteger(**test_input) == 123

test_input = { "nums": [17,18,19,20,21,22,23,24,25,26,27,9,2,5] }
assert my_solution.missingInteger(**test_input) == 242

test_input = { "nums": [43,44] }
assert my_solution.missingInteger(**test_input) == 87

test_input = { "nums": [19,20,5,3,10] }
assert my_solution.missingInteger(**test_input) == 39

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

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

test_input = { "nums": [47,48,49] }
assert my_solution.missingInteger(**test_input) == 144

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

test_input = { "nums": [39] }
assert my_solution.missingInteger(**test_input) == 40

test_input = { "nums": [11,12,13,14,15,7,5,2,10,5,6] }
assert my_solution.missingInteger(**test_input) == 65

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

test_input = { "nums": [29,30,31,32,33,34,35,36,37,38,39,40,41] }
assert my_solution.missingInteger(**test_input) == 455

test_input = { "nums": [24,25,26,27,28,29,30,31,32,33,34,35,6,4,1] }
assert my_solution.missingInteger(**test_input) == 354

test_input = { "nums": [7,8,9,10,11,12,13,14,15] }
assert my_solution.missingInteger(**test_input) == 99

test_input = { "nums": [39,40,41,42,43,44,45,8,10,4] }
assert my_solution.missingInteger(**test_input) == 294

test_input = { "nums": [36,37,6,8] }
assert my_solution.missingInteger(**test_input) == 73

test_input = { "nums": [27,28,29,30] }
assert my_solution.missingInteger(**test_input) == 114

test_input = { "nums": [34,35,5,7] }
assert my_solution.missingInteger(**test_input) == 69

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

test_input = { "nums": [36,37,38,39,8,10,7] }
assert my_solution.missingInteger(**test_input) == 150

test_input = { "nums": [28,29,6] }
assert my_solution.missingInteger(**test_input) == 57

test_input = { "nums": [14,15,16,17,18,19,20,10,9,10,9,7,3,6] }
assert my_solution.missingInteger(**test_input) == 119

test_input = { "nums": [27,28,29,5] }
assert my_solution.missingInteger(**test_input) == 84

test_input = { "nums": [42,43,44,45,46,47,48] }
assert my_solution.missingInteger(**test_input) == 315

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

test_input = { "nums": [32,33,34,35,36,37,5,8,5,3,4,2,10,3,7] }
assert my_solution.missingInteger(**test_input) == 207

test_input = { "nums": [24,25,26,27,28,29,30,31,32,33,1,3,9] }
assert my_solution.missingInteger(**test_input) == 285

test_input = { "nums": [48,49] }
assert my_solution.missingInteger(**test_input) == 97

test_input = { "nums": [46,47,6,7,1] }
assert my_solution.missingInteger(**test_input) == 93

test_input = { "nums": [32,33,34,35,36,37,38,39,40] }
assert my_solution.missingInteger(**test_input) == 324

test_input = { "nums": [40,41,42,43,44,45,6] }
assert my_solution.missingInteger(**test_input) == 255

test_input = { "nums": [5,6,7,8,9,10,11,12,13,14,15,16,17,18,9] }
assert my_solution.missingInteger(**test_input) == 161

test_input = { "nums": [39,40,41,3,4,7,10,6,2,10,1,9] }
assert my_solution.missingInteger(**test_input) == 120

test_input = { "nums": [17,18] }
assert my_solution.missingInteger(**test_input) == 35

test_input = { "nums": [41,42,43,44,45,46,5,6] }
assert my_solution.missingInteger(**test_input) == 261

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

test_input = { "nums": [46,47,48,49,50,7] }
assert my_solution.missingInteger(**test_input) == 240

test_input = { "nums": [17,18,19,20,21,22,23,24,25,26,4,7,5,4,4] }
assert my_solution.missingInteger(**test_input) == 215

test_input = { "nums": [40,41,42,43,44,45,46,4,6] }
assert my_solution.missingInteger(**test_input) == 301

test_input = { "nums": [13,4,2,2,3,4,1,8,3,7,7,7,1,6,3] }
assert my_solution.missingInteger(**test_input) == 14

test_input = { "nums": [4,5,6,7,8,9,10,11,12,13,14,15,16,6,8] }
assert my_solution.missingInteger(**test_input) == 130

test_input = { "nums": [12,10] }
assert my_solution.missingInteger(**test_input) == 13

test_input = { "nums": [17,18,19,20,21,5,3,7,10,5,3,7,3,5,3] }
assert my_solution.missingInteger(**test_input) == 95

test_input = { "nums": [38,39,40,41,42,43,44,45,5,7,9,9,4,1] }
assert my_solution.missingInteger(**test_input) == 332

test_input = { "nums": [32,33,34,35] }
assert my_solution.missingInteger(**test_input) == 134

test_input = { "nums": [33,34,7,3,4,4] }
assert my_solution.missingInteger(**test_input) == 67

test_input = { "nums": [33,34,35,36,37,38,39,40,41,42,43,44,45,46,47] }
assert my_solution.missingInteger(**test_input) == 600

test_input = { "nums": [14,9,6,9,7,9,10,4,9,9,4,4] }
assert my_solution.missingInteger(**test_input) == 15

test_input = { "nums": [18,19,20,21,22,23,24,25,26,6,8,2,1] }
assert my_solution.missingInteger(**test_input) == 198

test_input = { "nums": [19,20,21,7,9] }
assert my_solution.missingInteger(**test_input) == 60

test_input = { "nums": [19,20,21,10,1,8,2,1] }
assert my_solution.missingInteger(**test_input) == 60

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

test_input = { "nums": [48,10] }
assert my_solution.missingInteger(**test_input) == 49

test_input = { "nums": [20,21,22,23,24,25,5] }
assert my_solution.missingInteger(**test_input) == 135

test_input = { "nums": [40,41,42,43,3,4,10,3,7,8,9,1,5] }
assert my_solution.missingInteger(**test_input) == 166

test_input = { "nums": [21,22,23,24,25,26,27,8] }
assert my_solution.missingInteger(**test_input) == 168

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

test_input = { "nums": [9,10,11,12,13,14,15,16,17,4] }
assert my_solution.missingInteger(**test_input) == 117

test_input = { "nums": [25,26,27,28,29,6,8] }
assert my_solution.missingInteger(**test_input) == 135

test_input = { "nums": [16,17,18,19,20,21,22,23,24,25,6] }
assert my_solution.missingInteger(**test_input) == 205

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

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

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

test_input = { "nums": [34,35,36,37,38,39,1,9,3,3,10,7,1] }
assert my_solution.missingInteger(**test_input) == 219

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

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

test_input = { "nums": [25,26,27,4] }
assert my_solution.missingInteger(**test_input) == 78

test_input = { "nums": [31,32,33,8,5,3,7,2] }
assert my_solution.missingInteger(**test_input) == 96

test_input = { "nums": [38,39,40,41,42,43,44,45,1] }
assert my_solution.missingInteger(**test_input) == 332

test_input = { "nums": [35,36,3,10] }
assert my_solution.missingInteger(**test_input) == 71

test_input = { "nums": [31,32,33,34,35,7,6,1,9] }
assert my_solution.missingInteger(**test_input) == 165

test_input = { "nums": [47,48,49,2,2] }
assert my_solution.missingInteger(**test_input) == 144

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

test_input = { "nums": [50] }
assert my_solution.missingInteger(**test_input) == 51

test_input = { "nums": [14,15,16,17,7,10,3,10] }
assert my_solution.missingInteger(**test_input) == 62


minimum-number-of-operations-to-make-array-xor-equal-to-k

Minimum Number of Operations to Make Array XOR Equal to K

Prompt:
"""
给你一个下标从 0开始的整数数组nums和一个正整数k。
你可以对数组执行以下操作 任意次：

选择数组里的 任意一个元素，并将它的二进制表示翻转一个数位，翻转数位表示将0 变成1或者将 1变成 0。

你的目标是让数组里 所有元素的按位异或和得到 k，请你返回达成这一目标的 最少操作次数。
注意，你也可以将一个数的前导 0 翻转。比方说，数字(101)2翻转第四个数位，得到(1101)2。

示例 1：

输入：nums = [2,1,3,4], k = 1
输出：2
解释：我们可以执行以下操作：
- 选择下标为 2 的元素，也就是 3 == (011)2，我们翻转第一个数位得到 (010)2 == 2 。数组变为 [2,1,2,4] 。
- 选择下标为 0 的元素，也就是 2 == (010)2 ，我们翻转第三个数位得到 (110)2 == 6 。数组变为 [6,1,2,4] 。
最终数组的所有元素异或和为 (6 XOR 1 XOR 2 XOR 4) == 1 == k 。
无法用少于 2 次操作得到异或和等于 k 。

示例 2：

输入：nums = [2,0,2,0], k = 0
输出：0
解释：数组所有元素的异或和为 (2 XOR 0 XOR 2 XOR 0) == 0 == k 。所以不需要进行任何操作。

提示：

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

给你一个下标从 0开始的整数数组nums和一个正整数k。
你可以对数组执行以下操作 任意次：

选择数组里的 任意一个元素，并将它的二进制表示翻转一个数位，翻转数位表示将0 变成1或者将 1变成 0。

你的目标是让数组里 所有元素的按位异或和得到 k，请你返回达成这一目标的 最少操作次数。
注意，你也可以将一个数的前导 0 翻转。比方说，数字(101)2翻转第四个数位，得到(1101)2。

示例 1：

输入：nums = [2,1,3,4], k = 1
输出：2
解释：我们可以执行以下操作：
- 选择下标为 2 的元素，也就是 3 == (011)2，我们翻转第一个数位得到 (010)2 == 2 。数组变为 [2,1,2,4] 。
- 选择下标为 0 的元素，也就是 2 == (010)2 ，我们翻转第三个数位得到 (110)2 == 6 。数组变为 [6,1,2,4] 。
最终数组的所有元素异或和为 (6 XOR 1 XOR 2 XOR 4) == 1 == k 。
无法用少于 2 次操作得到异或和等于 k 。

示例 2：

输入：nums = [2,0,2,0], k = 0
输出：0
解释：数组所有元素的异或和为 (2 XOR 0 XOR 2 XOR 0) == 0 == k 。所以不需要进行任何操作。

提示：

1 <= nums.length <= 105
0 <= nums[i] <= 106
0 <= k <= 106

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

```

my_solution = Solution()

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

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

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

test_input = { "nums": [3,13,9,8,5,18,11,10], "k": 13 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [9,7,9,14,8,6], "k": 12 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [13,9,10,16,11,8,1], "k": 17 }
assert my_solution.minOperations(**test_input) == 3

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

test_input = { "nums": [18,18], "k": 20 }
assert my_solution.minOperations(**test_input) == 2

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

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

test_input = { "nums": [13,15,19,18,2,9,18,11,0,7], "k": 6 }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums": [9,15,19,15,10,15,14,0,2,5], "k": 20 }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums": [19,4,19,6,3,19,14,4,16,12], "k": 4 }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums": [2,10,5,5,12,3,14,6,11,14], "k": 3 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [11,20], "k": 10 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [10,12,5,3,16,0], "k": 1 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [0,4,4,7,14,13], "k": 1 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [16,2,20,13,15,20,13], "k": 16 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [19,11,11,0,16,2,2,0,9], "k": 4 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [10,17,19,8,15], "k": 19 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [8,17,7,18], "k": 6 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [10,20], "k": 7 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [11,14,5,9,19,3,1], "k": 10 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [19,13,16], "k": 4 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [12,18,13,2,1,5,8,5,8,6], "k": 7 }
assert my_solution.minOperations(**test_input) == 2

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

test_input = { "nums": [8,5,4,5,13,18], "k": 0 }
assert my_solution.minOperations(**test_input) == 3

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

test_input = { "nums": [6,9,15,17,16], "k": 19 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [14,0,17], "k": 2 }
assert my_solution.minOperations(**test_input) == 4

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

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

test_input = { "nums": [2,11,6,12,2,15,4,8,11], "k": 3 }
assert my_solution.minOperations(**test_input) == 2

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

test_input = { "nums": [11,14,18,14,6,18,4,16,20,5], "k": 16 }
assert my_solution.minOperations(**test_input) == 2

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

test_input = { "nums": [9,18,19,16,8,11,15], "k": 14 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [0,3,20,0,15,7,17,4], "k": 3 }
assert my_solution.minOperations(**test_input) == 2

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

test_input = { "nums": [2,7,13,16,2,2], "k": 15 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [2,12,11,11,2,12], "k": 17 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [10,8,10], "k": 11 }
assert my_solution.minOperations(**test_input) == 2

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

test_input = { "nums": [1,20,4,19,12,18,5,3,11,8], "k": 14 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [16,12,12], "k": 20 }
assert my_solution.minOperations(**test_input) == 1

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

test_input = { "nums": [20,0,19,14,7,0], "k": 18 }
assert my_solution.minOperations(**test_input) == 3

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

test_input = { "nums": [9,11,8,20,10], "k": 0 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [2,10,2,14,7,13,4,9,2], "k": 20 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [7,12,8], "k": 14 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [20,11,5,8,1,8,4,16], "k": 7 }
assert my_solution.minOperations(**test_input) == 1

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

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

test_input = { "nums": [19,6], "k": 13 }
assert my_solution.minOperations(**test_input) == 2

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

test_input = { "nums": [4,10,18,17,20,6,4], "k": 10 }
assert my_solution.minOperations(**test_input) == 2

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

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

test_input = { "nums": [14,4,0,18,18,8,4,9], "k": 17 }
assert my_solution.minOperations(**test_input) == 4

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

test_input = { "nums": [7,16,2,13,0,17,16], "k": 18 }
assert my_solution.minOperations(**test_input) == 3

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

test_input = { "nums": [13,14,9,19,5,13], "k": 8 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [4,15,10,15,11,1,3,5,18,13], "k": 16 }
assert my_solution.minOperations(**test_input) == 3

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

test_input = { "nums": [7,4,6,20,9,9,6,6], "k": 10 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [1,9,13,19,19,0,16,20,4], "k": 2 }
assert my_solution.minOperations(**test_input) == 3

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

test_input = { "nums": [11,20,5,16,15,11,8], "k": 11 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [12,10,16,18,17,4,2,19,17,2], "k": 19 }
assert my_solution.minOperations(**test_input) == 0

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

test_input = { "nums": [13,3,10,2,9,13,5,11,5], "k": 20 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [20,12,9,3,2,11], "k": 13 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [3,19,0,18,6], "k": 15 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [12,6], "k": 18 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [10,11,12,6,10,1,15], "k": 8 }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums": [12,8,1,16,6,12], "k": 2 }
assert my_solution.minOperations(**test_input) == 4

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

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

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

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

test_input = { "nums": [9,5,7,11,8,18,5,1,4], "k": 8 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [1,8,7,19,3,20,13,9,10], "k": 1 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [19,18,6], "k": 8 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [19,12,3,18,12,19,5,20], "k": 0 }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums": [6,18,12,9,20], "k": 13 }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums": [19,5,5,7,4,7,15], "k": 7 }
assert my_solution.minOperations(**test_input) == 5

test_input = { "nums": [17,7,19], "k": 18 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [14,13,3,15,18,20,2,9,3], "k": 14 }
assert my_solution.minOperations(**test_input) == 4

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

test_input = { "nums": [2,0,8], "k": 18 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [19,5,5,12,20,2,10,17], "k": 12 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [6,0,0,1,15,9,19,12], "k": 6 }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums": [8,16,13,8,18,9,16,16,19,11], "k": 12 }
assert my_solution.minOperations(**test_input) == 2

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

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

test_input = { "nums": [14,10,16,9,6,13,11,13,11,16], "k": 20 }
assert my_solution.minOperations(**test_input) == 5

test_input = { "nums": [13,19,0,12,11,10,11,2,6], "k": 7 }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums": [6,1,4,9,1,7,11,15,15,0], "k": 8 }
assert my_solution.minOperations(**test_input) == 4


minimum-number-of-operations-to-make-x-and-y-equal

Minimum Number of Operations to Make X and Y Equal

Prompt:
"""
给你两个正整数x 和y。
一次操作中，你可以执行以下四种操作之一：

如果 x是 11的倍数，将x除以11。
如果 x是 5的倍数，将 x除以 5。
将x 减1。
将x加1。

请你返回让 x和 y相等的 最少操作次数。

示例 1：

输入：x = 26, y = 1
输出：3
解释：我们可以通过以下操作将 26 变为 1 ：
1. 将 x 减 1
2. 将 x 除以 5
3. 将 x 除以 5
将 26 变为 1 最少需要 3 次操作。

示例 2：

输入：x = 54, y = 2
输出：4
解释：我们可以通过以下操作将 54 变为 2 ：
1. 将 x 加 1
2. 将 x 除以 11
3. 将 x 除以 5
4. 将 x 加 1
将 54 变为 2 最少需要 4 次操作。

示例 3：

输入：x = 25, y = 30
输出：5
解释：我们可以通过以下操作将 25 变为 30 ：
1. 将 x 加 1
2. 将 x 加 1
3. 将 x 加 1
4. 将 x 加 1
5. 将 x 加 1
将 25 变为 30 最少需要 5 次操作。

提示：

1 <= x, y <= 104
"""
class Solution:
    def minimumOperationsToMakeEqual(self, x: int, y: int) -> int:

给你两个正整数x 和y。
一次操作中，你可以执行以下四种操作之一：

如果 x是 11的倍数，将x除以11。
如果 x是 5的倍数，将 x除以 5。
将x 减1。
将x加1。

请你返回让 x和 y相等的 最少操作次数。

示例 1：

输入：x = 26, y = 1
输出：3
解释：我们可以通过以下操作将 26 变为 1 ：
1. 将 x 减 1
2. 将 x 除以 5
3. 将 x 除以 5
将 26 变为 1 最少需要 3 次操作。

示例 2：

输入：x = 54, y = 2
输出：4
解释：我们可以通过以下操作将 54 变为 2 ：
1. 将 x 加 1
2. 将 x 除以 11
3. 将 x 除以 5
4. 将 x 加 1
将 54 变为 2 最少需要 4 次操作。

示例 3：

输入：x = 25, y = 30
输出：5
解释：我们可以通过以下操作将 25 变为 30 ：
1. 将 x 加 1
2. 将 x 加 1
3. 将 x 加 1
4. 将 x 加 1
5. 将 x 加 1
将 25 变为 30 最少需要 5 次操作。

提示：

1 <= x, y <= 104

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

```

my_solution = Solution()

test_input = { "x": 26, "y": 1 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 3

test_input = { "x": 54, "y": 2 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 4

test_input = { "x": 25, "y": 30 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 5

test_input = { "x": 1, "y": 1 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 0

test_input = { "x": 1, "y": 2 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 1

test_input = { "x": 1, "y": 3 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 2

test_input = { "x": 1, "y": 4 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 3

test_input = { "x": 1, "y": 5 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 4

test_input = { "x": 1, "y": 6 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 5

test_input = { "x": 1, "y": 7 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 6

test_input = { "x": 1, "y": 8 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 7

test_input = { "x": 1, "y": 9 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 8

test_input = { "x": 1, "y": 10 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 9

test_input = { "x": 1, "y": 11 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 10

test_input = { "x": 1, "y": 12 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 11

test_input = { "x": 1, "y": 13 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 12

test_input = { "x": 1, "y": 14 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 13

test_input = { "x": 1, "y": 15 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 14

test_input = { "x": 1, "y": 16 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 15

test_input = { "x": 1, "y": 17 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 16

test_input = { "x": 1, "y": 18 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 17

test_input = { "x": 1, "y": 19 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 18

test_input = { "x": 1, "y": 20 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 19

test_input = { "x": 1, "y": 21 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 20

test_input = { "x": 1, "y": 22 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 21

test_input = { "x": 1, "y": 23 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 22

test_input = { "x": 1, "y": 24 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 23

test_input = { "x": 1, "y": 25 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 24

test_input = { "x": 2, "y": 1 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 1

test_input = { "x": 2, "y": 2 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 0

test_input = { "x": 2, "y": 3 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 1

test_input = { "x": 2, "y": 4 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 2

test_input = { "x": 2, "y": 5 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 3

test_input = { "x": 2, "y": 6 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 4

test_input = { "x": 2, "y": 7 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 5

test_input = { "x": 2, "y": 8 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 6

test_input = { "x": 2, "y": 9 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 7

test_input = { "x": 2, "y": 10 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 8

test_input = { "x": 2, "y": 11 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 9

test_input = { "x": 2, "y": 12 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 10

test_input = { "x": 2, "y": 13 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 11

test_input = { "x": 2, "y": 14 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 12

test_input = { "x": 2, "y": 15 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 13

test_input = { "x": 2, "y": 16 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 14

test_input = { "x": 2, "y": 17 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 15

test_input = { "x": 2, "y": 18 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 16

test_input = { "x": 2, "y": 19 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 17

test_input = { "x": 2, "y": 20 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 18

test_input = { "x": 2, "y": 21 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 19

test_input = { "x": 2, "y": 22 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 20

test_input = { "x": 2, "y": 23 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 21

test_input = { "x": 2, "y": 24 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 22

test_input = { "x": 2, "y": 25 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 23

test_input = { "x": 3, "y": 1 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 2

test_input = { "x": 3, "y": 2 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 1

test_input = { "x": 3, "y": 3 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 0

test_input = { "x": 3, "y": 4 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 1

test_input = { "x": 3, "y": 5 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 2

test_input = { "x": 3, "y": 6 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 3

test_input = { "x": 3, "y": 7 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 4

test_input = { "x": 3, "y": 8 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 5

test_input = { "x": 3, "y": 9 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 6

test_input = { "x": 3, "y": 10 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 7

test_input = { "x": 3, "y": 11 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 8

test_input = { "x": 3, "y": 12 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 9

test_input = { "x": 3, "y": 13 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 10

test_input = { "x": 3, "y": 14 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 11

test_input = { "x": 3, "y": 15 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 12

test_input = { "x": 3, "y": 16 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 13

test_input = { "x": 3, "y": 17 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 14

test_input = { "x": 3, "y": 18 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 15

test_input = { "x": 3, "y": 19 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 16

test_input = { "x": 3, "y": 20 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 17

test_input = { "x": 3, "y": 21 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 18

test_input = { "x": 3, "y": 22 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 19

test_input = { "x": 3, "y": 23 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 20

test_input = { "x": 3, "y": 24 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 21

test_input = { "x": 3, "y": 25 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 22

test_input = { "x": 4, "y": 1 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 2

test_input = { "x": 4, "y": 2 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 2

test_input = { "x": 4, "y": 3 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 1

test_input = { "x": 4, "y": 4 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 0

test_input = { "x": 4, "y": 5 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 1

test_input = { "x": 4, "y": 6 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 2

test_input = { "x": 4, "y": 7 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 3

test_input = { "x": 4, "y": 8 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 4

test_input = { "x": 4, "y": 9 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 5

test_input = { "x": 4, "y": 10 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 6

test_input = { "x": 4, "y": 11 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 7

test_input = { "x": 4, "y": 12 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 8

test_input = { "x": 4, "y": 13 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 9

test_input = { "x": 4, "y": 14 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 10

test_input = { "x": 4, "y": 15 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 11

test_input = { "x": 4, "y": 16 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 12

test_input = { "x": 4, "y": 17 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 13

test_input = { "x": 4, "y": 18 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 14

test_input = { "x": 4, "y": 19 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 15

test_input = { "x": 4, "y": 20 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 16

test_input = { "x": 4, "y": 21 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 17

test_input = { "x": 4, "y": 22 }
assert my_solution.minimumOperationsToMakeEqual(**test_input) == 18


count-the-number-of-powerful-integers

Count the Number of Powerful Integers

Prompt:
"""
给你三个整数start，finish和limit。同时给你一个下标从0开始的字符串s，表示一个 正整数。
如果一个 正整数x 末尾部分是s（换句话说，s是 x的 后缀），且 x中的每个数位至多是 limit，那么我们称 x是 强大的。
请你返回区间[start..finish]内强大整数的总数目。
如果一个字符串 x是 y中某个下标开始（包括0），到下标为y.length - 1结束的子字符串，那么我们称x是y的一个后缀。比方说，25是5125的一个后缀，但不是512的后缀。

示例 1：

输入：start = 1, finish = 6000, limit = 4, s = "124"
输出：5
解释：区间 [1..6000] 内的强大数字为 124 ，1124 ，2124 ，3124 和 4124 。这些整数的各个数位都 <= 4 且 "124" 是它们的后缀。注意 5124 不是强大整数，因为第一个数位 5 大于 4 。
这个区间内总共只有这 5 个强大整数。

示例 2：

输入：start = 15, finish = 215, limit = 6, s = "10"
输出：2
解释：区间 [15..215] 内的强大整数为 110 和 210 。这些整数的各个数位都 <= 6 且 "10" 是它们的后缀。
这个区间总共只有这 2 个强大整数。

示例 3：

输入：start = 1000, finish = 2000, limit = 4, s = "3000"
输出：0
解释：区间 [1000..2000] 内的整数都小于 3000 ，所以 "3000" 不可能是这个区间内任何整数的后缀。

提示：

1 <= start <= finish <= 1015
1 <= limit <= 9
1 <= s.length <= floor(log10(finish)) + 1
s数位中每个数字都小于等于limit。
s不包含任何前导 0 。
"""
class Solution:
    def numberOfPowerfulInt(self, start: int, finish: int, limit: int, s: str) -> int:

给你三个整数start，finish和limit。同时给你一个下标从0开始的字符串s，表示一个 正整数。
如果一个 正整数x 末尾部分是s（换句话说，s是 x的 后缀），且 x中的每个数位至多是 limit，那么我们称 x是 强大的。
请你返回区间[start..finish]内强大整数的总数目。
如果一个字符串 x是 y中某个下标开始（包括0），到下标为y.length - 1结束的子字符串，那么我们称x是y的一个后缀。比方说，25是5125的一个后缀，但不是512的后缀。

示例 1：

输入：start = 1, finish = 6000, limit = 4, s = "124"
输出：5
解释：区间 [1..6000] 内的强大数字为 124 ，1124 ，2124 ，3124 和 4124 。这些整数的各个数位都 <= 4 且 "124" 是它们的后缀。注意 5124 不是强大整数，因为第一个数位 5 大于 4 。
这个区间内总共只有这 5 个强大整数。

示例 2：

输入：start = 15, finish = 215, limit = 6, s = "10"
输出：2
解释：区间 [15..215] 内的强大整数为 110 和 210 。这些整数的各个数位都 <= 6 且 "10" 是它们的后缀。
这个区间总共只有这 2 个强大整数。

示例 3：

输入：start = 1000, finish = 2000, limit = 4, s = "3000"
输出：0
解释：区间 [1000..2000] 内的整数都小于 3000 ，所以 "3000" 不可能是这个区间内任何整数的后缀。

提示：

1 <= start <= finish <= 1015
1 <= limit <= 9
1 <= s.length <= floor(log10(finish)) + 1
s数位中每个数字都小于等于limit。
s不包含任何前导 0 。

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

```

my_solution = Solution()

test_input = { "start": 1, "finish": 6000, "limit": 4, "s": "124" }
assert my_solution.numberOfPowerfulInt(**test_input) == 5

test_input = { "start": 15, "finish": 215, "limit": 6, "s": "10" }
assert my_solution.numberOfPowerfulInt(**test_input) == 2

test_input = { "start": 1000, "finish": 2000, "limit": 4, "s": "3000" }
assert my_solution.numberOfPowerfulInt(**test_input) == 0

test_input = { "start": 141, "finish": 148, "limit": 9, "s": "9" }
assert my_solution.numberOfPowerfulInt(**test_input) == 0

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "17" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "27" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "41" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "47" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "61" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "66" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "71" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 1, "finish": 971, "limit": 9, "s": "72" }
assert my_solution.numberOfPowerfulInt(**test_input) == 9

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "24" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "32" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "41" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 20, "finish": 1159, "limit": 5, "s": "44" }
assert my_solution.numberOfPowerfulInt(**test_input) == 8

test_input = { "start": 1300, "finish": 1400, "limit": 5, "s": "245" }
assert my_solution.numberOfPowerfulInt(**test_input) == 0

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "13" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "21" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "34" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 3, "finish": 1429, "limit": 5, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "21" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "23" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "31" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "34" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 15, "finish": 1440, "limit": 5, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 10

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "24" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "30" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 10, "finish": 1844, "limit": 5, "s": "44" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "13" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 11

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "22" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "30" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 16, "finish": 1848, "limit": 5, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 12

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "1" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "10" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "100" }
assert my_solution.numberOfPowerfulInt(**test_input) == 2

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "11" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "12" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "13" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "14" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "15" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "16" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "17" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "18" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "2" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "20" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "21" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "22" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "23" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "24" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "25" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "26" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "27" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "28" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "3" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "30" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "31" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "32" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "33" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "34" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "35" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "36" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "37" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "38" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "4" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "40" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "41" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "42" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "43" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "44" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "45" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "46" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "47" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "48" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "5" }
assert my_solution.numberOfPowerfulInt(**test_input) == 162

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "50" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "51" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "52" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18

test_input = { "start": 1, "finish": 2000, "limit": 8, "s": "53" }
assert my_solution.numberOfPowerfulInt(**test_input) == 18


check-if-bitwise-or-has-trailing-zeros

Check if Bitwise OR Has Trailing Zeros

Prompt:
"""
给你一个 正整数 数组 nums 。
你需要检查是否可以从数组中选出 两个或更多 元素，满足这些元素的按位或运算（ OR）结果的二进制表示中 至少 存在一个尾随零。
例如，数字 5 的二进制表示是 "101"，不存在尾随零，而数字 4 的二进制表示是 "100"，存在两个尾随零。
如果可以选择两个或更多元素，其按位或运算结果存在尾随零，返回 true；否则，返回 false 。

示例 1：

输入：nums = [1,2,3,4,5]
输出：true
解释：如果选择元素 2 和 4，按位或运算结果是 6，二进制表示为 "110" ，存在一个尾随零。

示例 2：

输入：nums = [2,4,8,16]
输出：true
解释：如果选择元素 2 和 4，按位或运算结果是 6，二进制表示为 "110"，存在一个尾随零。
其他按位或运算结果存在尾随零的可能选择方案包括：(2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), 以及 (2, 4, 8, 16) 。

示例 3：

输入：nums = [1,3,5,7,9]
输出：false
解释：不存在按位或运算结果存在尾随零的选择方案。

提示：

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

给你一个 正整数 数组 nums 。
你需要检查是否可以从数组中选出 两个或更多 元素，满足这些元素的按位或运算（ OR）结果的二进制表示中 至少 存在一个尾随零。
例如，数字 5 的二进制表示是 "101"，不存在尾随零，而数字 4 的二进制表示是 "100"，存在两个尾随零。
如果可以选择两个或更多元素，其按位或运算结果存在尾随零，返回 true；否则，返回 false 。

示例 1：

输入：nums = [1,2,3,4,5]
输出：true
解释：如果选择元素 2 和 4，按位或运算结果是 6，二进制表示为 "110" ，存在一个尾随零。

示例 2：

输入：nums = [2,4,8,16]
输出：true
解释：如果选择元素 2 和 4，按位或运算结果是 6，二进制表示为 "110"，存在一个尾随零。
其他按位或运算结果存在尾随零的可能选择方案包括：(2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), 以及 (2, 4, 8, 16) 。

示例 3：

输入：nums = [1,3,5,7,9]
输出：false
解释：不存在按位或运算结果存在尾随零的选择方案。

提示：

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

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

```

my_solution = Solution()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [7,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

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

test_input = { "nums": [9,73] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

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

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

test_input = { "nums": [19,35] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [19,51] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

test_input = { "nums": [25,25] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

test_input = { "nums": [27,77] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

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

test_input = { "nums": [16,32] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [29,13] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [37,69] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [39,53] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

test_input = { "nums": [42,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [45,24] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [64,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [49,23] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

test_input = { "nums": [8,16,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [57,27] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

test_input = { "nums": [10,4,6] }
assert my_solution.hasTrailingZeros(**test_input) == True

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

test_input = { "nums": [63,47] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [67,69] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [69,87] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,8,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [77,49] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [89,31] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

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

test_input = { "nums": [3,69,59] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

test_input = { "nums": [7,77,9] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [9,77,51] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,32,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,32,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

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

test_input = { "nums": [10,7,5] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [11,23,27] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [15,13,63] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [21,27,79] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [23,23,47] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [35,91,15] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [32,4,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [32,8,48] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [33,40,84] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [41,83,53] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

test_input = { "nums": [75,34,58] }
assert my_solution.hasTrailingZeros(**test_input) == True

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

test_input = { "nums": [43,15,41] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [43,65,79] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [47,7,19] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

test_input = { "nums": [49,73,81] }
assert my_solution.hasTrailingZeros(**test_input) == False

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

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

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

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

test_input = { "nums": [8,6,4,32] }
assert my_solution.hasTrailingZeros(**test_input) == True

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

test_input = { "nums": [12,64,16,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,4,8,16] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [51,33,25] }
assert my_solution.hasTrailingZeros(**test_input) == False

test_input = { "nums": [16,8,64,4] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [16,16,12,8] }
assert my_solution.hasTrailingZeros(**test_input) == True

test_input = { "nums": [51,43,9] }
assert my_solution.hasTrailingZeros(**test_input) == False


find-longest-special-substring-that-occurs-thrice-i

Find Longest Special Substring That Occurs Thrice I

Prompt:
"""
给你一个仅由小写英文字母组成的字符串 s 。
如果一个字符串仅由单一字符组成，那么它被称为 特殊 字符串。例如，字符串 "abc" 不是特殊字符串，而字符串 "ddd"、"zz" 和 "f" 是特殊字符串。
返回在 s 中出现 至少三次 的 最长特殊子字符串 的长度，如果不存在出现至少三次的特殊子字符串，则返回 -1 。
子字符串 是字符串中的一个连续 非空 字符序列。

示例 1：

输入：s = "aaaa"
输出：2
解释：出现三次的最长特殊子字符串是 "aa" ：子字符串 "aaaa"、"aaaa" 和 "aaaa"。
可以证明最大长度是 2 。

示例 2：

输入：s = "abcdef"
输出：-1
解释：不存在出现至少三次的特殊子字符串。因此返回 -1 。

示例 3：

输入：s = "abcaba"
输出：1
解释：出现三次的最长特殊子字符串是 "a" ：子字符串 "abcaba"、"abcaba" 和 "abcaba"。
可以证明最大长度是 1 。

提示：

3 <= s.length <= 50
s 仅由小写英文字母组成。
"""
class Solution:
    def maximumLength(self, s: str) -> int:

给你一个仅由小写英文字母组成的字符串 s 。
如果一个字符串仅由单一字符组成，那么它被称为 特殊 字符串。例如，字符串 "abc" 不是特殊字符串，而字符串 "ddd"、"zz" 和 "f" 是特殊字符串。
返回在 s 中出现 至少三次 的 最长特殊子字符串 的长度，如果不存在出现至少三次的特殊子字符串，则返回 -1 。
子字符串 是字符串中的一个连续 非空 字符序列。

示例 1：

输入：s = "aaaa"
输出：2
解释：出现三次的最长特殊子字符串是 "aa" ：子字符串 "aaaa"、"aaaa" 和 "aaaa"。
可以证明最大长度是 2 。

示例 2：

输入：s = "abcdef"
输出：-1
解释：不存在出现至少三次的特殊子字符串。因此返回 -1 。

示例 3：

输入：s = "abcaba"
输出：1
解释：出现三次的最长特殊子字符串是 "a" ：子字符串 "abcaba"、"abcaba" 和 "abcaba"。
可以证明最大长度是 1 。

提示：

3 <= s.length <= 50
s 仅由小写英文字母组成。

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

```

my_solution = Solution()

test_input = { "s": "aaaa" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "abcdef" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "abcaba" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "abcccccdddd" }
assert my_solution.maximumLength(**test_input) == 3

test_input = { "s": "aaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "acc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cab" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cad" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cbc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dca" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "fff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ggg" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kkk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "lll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ppp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxx" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "yyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "aaau" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "affe" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "agae" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "aiii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbbb" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbbz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "beee" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bnnn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bsss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bxxx" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cafc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ccag" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "cfff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dddd" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "dsss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eeew" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gfdc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "giii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hhhn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hyyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "iiii" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "jiii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "jjjj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "kbbb" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "looo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnnn" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "oaaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "osss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "pppp" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "pppw" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqqc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqqo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqqq" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "reee" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rzzz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "thhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "tttt" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "unnn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "uuuu" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "uyyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vfff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vvvv" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "wbbb" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "wqqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "wwwg" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxxk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxxx" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "zfff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ammmm" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "aqqqu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "axxxx" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bahhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbbbz" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "biaei" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "bjjjj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "cccll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ceaaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cjlll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "crqqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cyyyy" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "ddddj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "ddddt" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "dkkkk" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "eefff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "efage" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "epppp" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "fafff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ffbbb" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ffffr" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "gcgbf" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "gcooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gfgec" }
assert my_solution.maximumLength(**test_input) == -1


find-longest-special-substring-that-occurs-thrice-ii

Find Longest Special Substring That Occurs Thrice II

Prompt:
"""
给你一个仅由小写英文字母组成的字符串 s 。
如果一个字符串仅由单一字符组成，那么它被称为 特殊 字符串。例如，字符串 "abc" 不是特殊字符串，而字符串 "ddd"、"zz" 和 "f" 是特殊字符串。
返回在 s 中出现 至少三次 的 最长特殊子字符串 的长度，如果不存在出现至少三次的特殊子字符串，则返回 -1 。
子字符串 是字符串中的一个连续 非空 字符序列。

示例 1：

输入：s = "aaaa"
输出：2
解释：出现三次的最长特殊子字符串是 "aa" ：子字符串 "aaaa"、"aaaa" 和 "aaaa"。
可以证明最大长度是 2 。

示例 2：

输入：s = "abcdef"
输出：-1
解释：不存在出现至少三次的特殊子字符串。因此返回 -1 。

示例 3：

输入：s = "abcaba"
输出：1
解释：出现三次的最长特殊子字符串是 "a" ：子字符串 "abcaba"、"abcaba" 和 "abcaba"。
可以证明最大长度是 1 。

提示：

3 <= s.length <= 5 * 105
s 仅由小写英文字母组成。
"""
class Solution:
    def maximumLength(self, s: str) -> int:

给你一个仅由小写英文字母组成的字符串 s 。
如果一个字符串仅由单一字符组成，那么它被称为 特殊 字符串。例如，字符串 "abc" 不是特殊字符串，而字符串 "ddd"、"zz" 和 "f" 是特殊字符串。
返回在 s 中出现 至少三次 的 最长特殊子字符串 的长度，如果不存在出现至少三次的特殊子字符串，则返回 -1 。
子字符串 是字符串中的一个连续 非空 字符序列。

示例 1：

输入：s = "aaaa"
输出：2
解释：出现三次的最长特殊子字符串是 "aa" ：子字符串 "aaaa"、"aaaa" 和 "aaaa"。
可以证明最大长度是 2 。

示例 2：

输入：s = "abcdef"
输出：-1
解释：不存在出现至少三次的特殊子字符串。因此返回 -1 。

示例 3：

输入：s = "abcaba"
输出：1
解释：出现三次的最长特殊子字符串是 "a" ：子字符串 "abcaba"、"abcaba" 和 "abcaba"。
可以证明最大长度是 1 。

提示：

3 <= s.length <= 5 * 105
s 仅由小写英文字母组成。

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

```

my_solution = Solution()

test_input = { "s": "aaaa" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "abcdef" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "abcaba" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "abcccccdddd" }
assert my_solution.maximumLength(**test_input) == 3

test_input = { "s": "acd" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "bad" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "bbc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cda" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "dab" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eee" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "fff" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "jjj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kkk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "lll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "mmm" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ppp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "sss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "vvv" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "yyy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "aaaj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "aada" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "accc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "auuu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "azzz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbbb" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbbr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bccc" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "brrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cccc" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "clll" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dbac" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "dddd" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "dddr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dddu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dzzz" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eeee" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "efda" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "efdc" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "ekkk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ggge" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gggp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gggr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gggy" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "guuu" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hwww" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hxxx" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "jjjj" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "jjjk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "kkkk" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "lllm" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "lttt" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "mwww" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnnd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "nnni" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "oooe" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "oooh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "oooo" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "oooq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "paaa" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "pggg" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "qooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "rrrr" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "smmm" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "thhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "tttt" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "uuuu" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "vppp" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xqqq" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "xxxj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ysss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "zzzz" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "aaaak" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "bbbjj" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bbvvv" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "bfooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "buooo" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cffff" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "cirrr" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "cwwwv" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "ddhhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "deeee" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "deiii" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "dtttk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eeeeq" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "eeekk" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "eesss" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "euuuu" }
assert my_solution.maximumLength(**test_input) == 2

test_input = { "s": "euylz" }
assert my_solution.maximumLength(**test_input) == -1

test_input = { "s": "fffhh" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "fpddd" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gcccn" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "gtwww" }
assert my_solution.maximumLength(**test_input) == 1

test_input = { "s": "hcfff" }
assert my_solution.maximumLength(**test_input) == 1