separate-black-and-white-balls

Separate Black and White Balls

Prompt:
"""
桌子上有 n 个球，每个球的颜色不是黑色，就是白色。
给你一个长度为 n 、下标从 0 开始的二进制字符串 s，其中 1 和 0 分别代表黑色和白色的球。
在每一步中，你可以选择两个相邻的球并交换它们。
返回「将所有黑色球都移到右侧，所有白色球都移到左侧所需的 最小步数」。

示例 1：

输入：s = "101"
输出：1
解释：我们可以按以下方式将所有黑色球移到右侧：
- 交换 s[0] 和 s[1]，s = "011"。
最开始，1 没有都在右侧，需要至少 1 步将其移到右侧。
示例 2：

输入：s = "100"
输出：2
解释：我们可以按以下方式将所有黑色球移到右侧：
- 交换 s[0] 和 s[1]，s = "010"。
- 交换 s[1] 和 s[2]，s = "001"。
可以证明所需的最小步数为 2 。

示例 3：

输入：s = "0111"
输出：0
解释：所有黑色球都已经在右侧。

提示：

1 <= n == s.length <= 105
s[i] 不是 '0'，就是 '1'。
"""
class Solution:
    def minimumSteps(self, s: str) -> int:

桌子上有 n 个球，每个球的颜色不是黑色，就是白色。
给你一个长度为 n 、下标从 0 开始的二进制字符串 s，其中 1 和 0 分别代表黑色和白色的球。
在每一步中，你可以选择两个相邻的球并交换它们。
返回「将所有黑色球都移到右侧，所有白色球都移到左侧所需的 最小步数」。

示例 1：

输入：s = "101"
输出：1
解释：我们可以按以下方式将所有黑色球移到右侧：
- 交换 s[0] 和 s[1]，s = "011"。
最开始，1 没有都在右侧，需要至少 1 步将其移到右侧。
示例 2：

输入：s = "100"
输出：2
解释：我们可以按以下方式将所有黑色球移到右侧：
- 交换 s[0] 和 s[1]，s = "010"。
- 交换 s[1] 和 s[2]，s = "001"。
可以证明所需的最小步数为 2 。

示例 3：

输入：s = "0111"
输出：0
解释：所有黑色球都已经在右侧。

提示：

1 <= n == s.length <= 105
s[i] 不是 '0'，就是 '1'。

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

```

my_solution = Solution()

test_input = { "s": "101" }
assert my_solution.minimumSteps(**test_input) == 1

test_input = { "s": "100" }
assert my_solution.minimumSteps(**test_input) == 2

test_input = { "s": "0111" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "11000111" }
assert my_solution.minimumSteps(**test_input) == 6

test_input = { "s": "01010001" }
assert my_solution.minimumSteps(**test_input) == 7

test_input = { "s": "0100101" }
assert my_solution.minimumSteps(**test_input) == 4

test_input = { "s": "111111111100100010" }
assert my_solution.minimumSteps(**test_input) == 65

test_input = { "s": "10100000110010011010" }
assert my_solution.minimumSteps(**test_input) == 44

test_input = { "s": "1101110000111011110" }
assert my_solution.minimumSteps(**test_input) == 42

test_input = { "s": "01000010111010001" }
assert my_solution.minimumSteps(**test_input) == 29

test_input = { "s": "11110" }
assert my_solution.minimumSteps(**test_input) == 4

test_input = { "s": "010001001011010" }
assert my_solution.minimumSteps(**test_input) == 21

test_input = { "s": "0011011" }
assert my_solution.minimumSteps(**test_input) == 2

test_input = { "s": "001" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "000100100" }
assert my_solution.minimumSteps(**test_input) == 6

test_input = { "s": "00110" }
assert my_solution.minimumSteps(**test_input) == 2

test_input = { "s": "001110001110001" }
assert my_solution.minimumSteps(**test_input) == 27

test_input = { "s": "10000000001" }
assert my_solution.minimumSteps(**test_input) == 9

test_input = { "s": "01" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "0100011100001100100" }
assert my_solution.minimumSteps(**test_input) == 45

test_input = { "s": "1010110" }
assert my_solution.minimumSteps(**test_input) == 7

test_input = { "s": "010010000" }
assert my_solution.minimumSteps(**test_input) == 10

test_input = { "s": "100110" }
assert my_solution.minimumSteps(**test_input) == 5

test_input = { "s": "1100" }
assert my_solution.minimumSteps(**test_input) == 4

test_input = { "s": "000110" }
assert my_solution.minimumSteps(**test_input) == 2

test_input = { "s": "001101101111000000" }
assert my_solution.minimumSteps(**test_input) == 54

test_input = { "s": "011101011" }
assert my_solution.minimumSteps(**test_input) == 7

test_input = { "s": "0110111111110" }
assert my_solution.minimumSteps(**test_input) == 12

test_input = { "s": "1111001111111011111" }
assert my_solution.minimumSteps(**test_input) == 19

test_input = { "s": "0101111" }
assert my_solution.minimumSteps(**test_input) == 1

test_input = { "s": "00010101100110011" }
assert my_solution.minimumSteps(**test_input) == 23

test_input = { "s": "01010110110111011001" }
assert my_solution.minimumSteps(**test_input) == 44

test_input = { "s": "0" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "1101111010111001010" }
assert my_solution.minimumSteps(**test_input) == 58

test_input = { "s": "01100010" }
assert my_solution.minimumSteps(**test_input) == 9

test_input = { "s": "10010000010" }
assert my_solution.minimumSteps(**test_input) == 15

test_input = { "s": "11011101000100001" }
assert my_solution.minimumSteps(**test_input) == 53

test_input = { "s": "00" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "10100101011001100111" }
assert my_solution.minimumSteps(**test_input) == 40

test_input = { "s": "0101" }
assert my_solution.minimumSteps(**test_input) == 1

test_input = { "s": "00101010100" }
assert my_solution.minimumSteps(**test_input) == 14

test_input = { "s": "00110111110010" }
assert my_solution.minimumSteps(**test_input) == 24

test_input = { "s": "111010000001000001" }
assert my_solution.minimumSteps(**test_input) == 52

test_input = { "s": "0101101000111010" }
assert my_solution.minimumSteps(**test_input) == 31

test_input = { "s": "1010111111" }
assert my_solution.minimumSteps(**test_input) == 3

test_input = { "s": "110110001001110" }
assert my_solution.minimumSteps(**test_input) == 32

test_input = { "s": "111010" }
assert my_solution.minimumSteps(**test_input) == 7

test_input = { "s": "10" }
assert my_solution.minimumSteps(**test_input) == 1

test_input = { "s": "111110" }
assert my_solution.minimumSteps(**test_input) == 5

test_input = { "s": "0111100000101101110" }
assert my_solution.minimumSteps(**test_input) == 42

test_input = { "s": "111010100" }
assert my_solution.minimumSteps(**test_input) == 17

test_input = { "s": "0001000100111000" }
assert my_solution.minimumSteps(**test_input) == 22

test_input = { "s": "011001111110110010" }
assert my_solution.minimumSteps(**test_input) == 43

test_input = { "s": "11100" }
assert my_solution.minimumSteps(**test_input) == 6

test_input = { "s": "0100001101110001" }
assert my_solution.minimumSteps(**test_input) == 25

test_input = { "s": "111" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "100010" }
assert my_solution.minimumSteps(**test_input) == 5

test_input = { "s": "101001" }
assert my_solution.minimumSteps(**test_input) == 5

test_input = { "s": "00111010100100100111" }
assert my_solution.minimumSteps(**test_input) == 43

test_input = { "s": "100010111" }
assert my_solution.minimumSteps(**test_input) == 5

test_input = { "s": "001110000101011" }
assert my_solution.minimumSteps(**test_input) == 21

test_input = { "s": "111011011101101" }
assert my_solution.minimumSteps(**test_input) == 26

test_input = { "s": "1110101" }
assert my_solution.minimumSteps(**test_input) == 7

test_input = { "s": "00111010100111" }
assert my_solution.minimumSteps(**test_input) == 17

test_input = { "s": "010" }
assert my_solution.minimumSteps(**test_input) == 1

test_input = { "s": "111001" }
assert my_solution.minimumSteps(**test_input) == 6

test_input = { "s": "1100011" }
assert my_solution.minimumSteps(**test_input) == 6

test_input = { "s": "0110001011001110111" }
assert my_solution.minimumSteps(**test_input) == 27

test_input = { "s": "0001111111011101" }
assert my_solution.minimumSteps(**test_input) == 17

test_input = { "s": "0110110100001" }
assert my_solution.minimumSteps(**test_input) == 26

test_input = { "s": "11110110011000011" }
assert my_solution.minimumSteps(**test_input) == 48

test_input = { "s": "10100" }
assert my_solution.minimumSteps(**test_input) == 5

test_input = { "s": "10100001" }
assert my_solution.minimumSteps(**test_input) == 9

test_input = { "s": "01000011000" }
assert my_solution.minimumSteps(**test_input) == 13

test_input = { "s": "110001001001" }
assert my_solution.minimumSteps(**test_input) == 20

test_input = { "s": "01100011010011110" }
assert my_solution.minimumSteps(**test_input) == 29

test_input = { "s": "01111001111" }
assert my_solution.minimumSteps(**test_input) == 8

test_input = { "s": "1110100010000110110" }
assert my_solution.minimumSteps(**test_input) == 51

test_input = { "s": "1101000111001111100" }
assert my_solution.minimumSteps(**test_input) == 45

test_input = { "s": "0110000" }
assert my_solution.minimumSteps(**test_input) == 8

test_input = { "s": "001010010010" }
assert my_solution.minimumSteps(**test_input) == 15

test_input = { "s": "11101" }
assert my_solution.minimumSteps(**test_input) == 3

test_input = { "s": "00110110" }
assert my_solution.minimumSteps(**test_input) == 6

test_input = { "s": "001010" }
assert my_solution.minimumSteps(**test_input) == 3

test_input = { "s": "000101010101010" }
assert my_solution.minimumSteps(**test_input) == 21

test_input = { "s": "1111011" }
assert my_solution.minimumSteps(**test_input) == 4

test_input = { "s": "0000101011001101011" }
assert my_solution.minimumSteps(**test_input) == 24

test_input = { "s": "011010" }
assert my_solution.minimumSteps(**test_input) == 5

test_input = { "s": "110010100011110101" }
assert my_solution.minimumSteps(**test_input) == 36

test_input = { "s": "000000001" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "011001" }
assert my_solution.minimumSteps(**test_input) == 4

test_input = { "s": "01111010011110111111" }
assert my_solution.minimumSteps(**test_input) == 23

test_input = { "s": "10001111" }
assert my_solution.minimumSteps(**test_input) == 3

test_input = { "s": "11011010001111" }
assert my_solution.minimumSteps(**test_input) == 21

test_input = { "s": "0110101010100000111" }
assert my_solution.minimumSteps(**test_input) == 44

test_input = { "s": "0000001000110" }
assert my_solution.minimumSteps(**test_input) == 6

test_input = { "s": "1" }
assert my_solution.minimumSteps(**test_input) == 0

test_input = { "s": "0111100110100" }
assert my_solution.minimumSteps(**test_input) == 28

test_input = { "s": "101010110011101011" }
assert my_solution.minimumSteps(**test_input) == 33

test_input = { "s": "1011101" }
assert my_solution.minimumSteps(**test_input) == 5


maximum-xor-product

Maximum Xor Product

Prompt:
"""
给你三个整数a，b和n，请你返回(a XOR x) * (b XOR x)的最大值且 x需要满足 0 <= x < 2n。
由于答案可能会很大，返回它对109 + 7取余后的结果。
注意，XOR是按位异或操作。

示例 1：

输入：a = 12, b = 5, n = 4
输出：98
解释：当 x = 2 时，(a XOR x) = 14 且 (b XOR x) = 7 。所以，(a XOR x) * (b XOR x) = 98 。
98 是所有满足 0 <= x < 2n 中 (a XOR x) * (b XOR x) 的最大值。

示例 2：

输入：a = 6, b = 7 , n = 5
输出：930
解释：当 x = 25 时，(a XOR x) = 31 且 (b XOR x) = 30 。所以，(a XOR x) * (b XOR x) = 930 。
930 是所有满足 0 <= x < 2n 中 (a XOR x) * (b XOR x) 的最大值。
示例 3：

输入：a = 1, b = 6, n = 3
输出：12
解释： 当 x = 5 时，(a XOR x) = 4 且 (b XOR x) = 3 。所以，(a XOR x) * (b XOR x) = 12 。
12 是所有满足 0 <= x < 2n 中 (a XOR x) * (b XOR x) 的最大值。

提示：

0 <= a, b < 250
0 <= n <= 50
"""
class Solution:
    def maximumXorProduct(self, a: int, b: int, n: int) -> int:

给你三个整数a，b和n，请你返回(a XOR x) * (b XOR x)的最大值且 x需要满足 0 <= x < 2n。
由于答案可能会很大，返回它对109 + 7取余后的结果。
注意，XOR是按位异或操作。

示例 1：

输入：a = 12, b = 5, n = 4
输出：98
解释：当 x = 2 时，(a XOR x) = 14 且 (b XOR x) = 7 。所以，(a XOR x) * (b XOR x) = 98 。
98 是所有满足 0 <= x < 2n 中 (a XOR x) * (b XOR x) 的最大值。

示例 2：

输入：a = 6, b = 7 , n = 5
输出：930
解释：当 x = 25 时，(a XOR x) = 31 且 (b XOR x) = 30 。所以，(a XOR x) * (b XOR x) = 930 。
930 是所有满足 0 <= x < 2n 中 (a XOR x) * (b XOR x) 的最大值。
示例 3：

输入：a = 1, b = 6, n = 3
输出：12
解释： 当 x = 5 时，(a XOR x) = 4 且 (b XOR x) = 3 。所以，(a XOR x) * (b XOR x) = 12 。
12 是所有满足 0 <= x < 2n 中 (a XOR x) * (b XOR x) 的最大值。

提示：

0 <= a, b < 250
0 <= n <= 50

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

```

my_solution = Solution()

test_input = { "a": 12, "b": 5, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 98

test_input = { "a": 6, "b": 7, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 930

test_input = { "a": 1, "b": 6, "n": 3 }
assert my_solution.maximumXorProduct(**test_input) == 12

test_input = { "a": 0, "b": 0, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 1

test_input = { "a": 0, "b": 1, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3906

test_input = { "a": 0, "b": 2, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 15875

test_input = { "a": 0, "b": 3, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 2

test_input = { "a": 0, "b": 4, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 0

test_input = { "a": 0, "b": 5, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3658

test_input = { "a": 0, "b": 6, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 7

test_input = { "a": 0, "b": 7, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 12

test_input = { "a": 0, "b": 8, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 713

test_input = { "a": 0, "b": 9, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 30

test_input = { "a": 0, "b": 10, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 14875

test_input = { "a": 0, "b": 11, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 84

test_input = { "a": 0, "b": 12, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 45

test_input = { "a": 0, "b": 13, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 42

test_input = { "a": 0, "b": 14, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 0

test_input = { "a": 0, "b": 15, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3080

test_input = { "a": 1, "b": 0, "n": 3 }
assert my_solution.maximumXorProduct(**test_input) == 42

test_input = { "a": 1, "b": 1, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 225

test_input = { "a": 1, "b": 2, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3782

test_input = { "a": 1, "b": 3, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 3

test_input = { "a": 1, "b": 4, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 810

test_input = { "a": 1, "b": 5, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 165

test_input = { "a": 1, "b": 6, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 132

test_input = { "a": 1, "b": 7, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 15

test_input = { "a": 1, "b": 8, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 8

test_input = { "a": 1, "b": 9, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 33

test_input = { "a": 1, "b": 10, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 14756

test_input = { "a": 1, "b": 11, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 14875

test_input = { "a": 1, "b": 12, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 14518

test_input = { "a": 1, "b": 13, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 13

test_input = { "a": 1, "b": 14, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 552

test_input = { "a": 1, "b": 15, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 63

test_input = { "a": 2, "b": 0, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 0

test_input = { "a": 2, "b": 1, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 2

test_input = { "a": 2, "b": 2, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 4

test_input = { "a": 2, "b": 3, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 930

test_input = { "a": 2, "b": 4, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 143

test_input = { "a": 2, "b": 5, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 756

test_input = { "a": 2, "b": 6, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 165

test_input = { "a": 2, "b": 7, "n": 3 }
assert my_solution.maximumXorProduct(**test_input) == 18

test_input = { "a": 2, "b": 8, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 27

test_input = { "a": 2, "b": 9, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 24

test_input = { "a": 2, "b": 10, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 713

test_input = { "a": 2, "b": 11, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 22

test_input = { "a": 2, "b": 12, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 39

test_input = { "a": 2, "b": 13, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 36

test_input = { "a": 2, "b": 14, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 28

test_input = { "a": 2, "b": 15, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 42

test_input = { "a": 3, "b": 0, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3782

test_input = { "a": 3, "b": 1, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3843

test_input = { "a": 3, "b": 2, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 6

test_input = { "a": 3, "b": 3, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 16129

test_input = { "a": 3, "b": 4, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 756

test_input = { "a": 3, "b": 5, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 143

test_input = { "a": 3, "b": 6, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 18

test_input = { "a": 3, "b": 7, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 21

test_input = { "a": 3, "b": 8, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3300

test_input = { "a": 3, "b": 9, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 27

test_input = { "a": 3, "b": 10, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 690

test_input = { "a": 3, "b": 11, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 33

test_input = { "a": 3, "b": 12, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 36

test_input = { "a": 3, "b": 13, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 39

test_input = { "a": 3, "b": 14, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 42

test_input = { "a": 3, "b": 15, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3245

test_input = { "a": 4, "b": 0, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 165

test_input = { "a": 4, "b": 1, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 18

test_input = { "a": 4, "b": 2, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 15

test_input = { "a": 4, "b": 3, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 12

test_input = { "a": 4, "b": 4, "n": 3 }
assert my_solution.maximumXorProduct(**test_input) == 49

test_input = { "a": 4, "b": 5, "n": 3 }
assert my_solution.maximumXorProduct(**test_input) == 42

test_input = { "a": 4, "b": 6, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 35

test_input = { "a": 4, "b": 7, "n": 3 }
assert my_solution.maximumXorProduct(**test_input) == 30

test_input = { "a": 4, "b": 8, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 77

test_input = { "a": 4, "b": 9, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 14518

test_input = { "a": 4, "b": 10, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 40

test_input = { "a": 4, "b": 11, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 552

test_input = { "a": 4, "b": 12, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3465

test_input = { "a": 4, "b": 13, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 14994

test_input = { "a": 4, "b": 14, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 667

test_input = { "a": 4, "b": 15, "n": 6 }
assert my_solution.maximumXorProduct(**test_input) == 3300

test_input = { "a": 5, "b": 0, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 4

test_input = { "a": 5, "b": 1, "n": 3 }
assert my_solution.maximumXorProduct(**test_input) == 21

test_input = { "a": 5, "b": 2, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 12

test_input = { "a": 5, "b": 3, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 15375

test_input = { "a": 5, "b": 4, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 16002

test_input = { "a": 5, "b": 5, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 25

test_input = { "a": 5, "b": 6, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 30

test_input = { "a": 5, "b": 7, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 35

test_input = { "a": 5, "b": 8, "n": 2 }
assert my_solution.maximumXorProduct(**test_input) == 70

test_input = { "a": 5, "b": 9, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 77

test_input = { "a": 5, "b": 10, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 552

test_input = { "a": 5, "b": 11, "n": 7 }
assert my_solution.maximumXorProduct(**test_input) == 14399

test_input = { "a": 5, "b": 12, "n": 1 }
assert my_solution.maximumXorProduct(**test_input) == 60

test_input = { "a": 5, "b": 13, "n": 5 }
assert my_solution.maximumXorProduct(**test_input) == 713

test_input = { "a": 5, "b": 14, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 84

test_input = { "a": 5, "b": 15, "n": 0 }
assert my_solution.maximumXorProduct(**test_input) == 75

test_input = { "a": 6, "b": 0, "n": 4 }
assert my_solution.maximumXorProduct(**test_input) == 143


find-building-where-alice-and-bob-can-meet

Find Building Where Alice and Bob Can Meet

Prompt:
"""
给你一个下标从 0开始的正整数数组heights，其中heights[i]表示第 i栋建筑的高度。
如果一个人在建筑i，且存在i < j的建筑j满足heights[i] < heights[j]，那么这个人可以移动到建筑j。
给你另外一个数组queries，其中queries[i] = [ai, bi]。第i个查询中，Alice 在建筑ai ，Bob 在建筑bi。
请你能返回一个数组ans，其中ans[i]是第i个查询中，Alice 和 Bob 可以相遇的最左边的建筑。如果对于查询i，Alice 和 Bob 不能相遇，令ans[i] 为-1。

示例 1：

输入：heights = [6,4,8,5,2,7], queries = [[0,1],[0,3],[2,4],[3,4],[2,2]]
输出：[2,5,-1,5,2]
解释：第一个查询中，Alice 和 Bob 可以移动到建筑 2 ，因为 heights[0] < heights[2] 且 heights[1] < heights[2] 。
第二个查询中，Alice 和 Bob 可以移动到建筑 5 ，因为 heights[0] < heights[5] 且 heights[3] < heights[5] 。
第三个查询中，Alice 无法与 Bob 相遇，因为 Alice 不能移动到任何其他建筑。
第四个查询中，Alice 和 Bob 可以移动到建筑 5 ，因为 heights[3] < heights[5] 且 heights[4] < heights[5] 。
第五个查询中，Alice 和 Bob 已经在同一栋建筑中。
对于 ans[i] != -1 ，ans[i] 是 Alice 和 Bob 可以相遇的建筑中最左边建筑的下标。
对于 ans[i] == -1 ，不存在 Alice 和 Bob 可以相遇的建筑。

示例 2：

输入：heights = [5,3,8,2,6,1,4,6], queries = [[0,7],[3,5],[5,2],[3,0],[1,6]]
输出：[7,6,-1,4,6]
解释：第一个查询中，Alice 可以直接移动到 Bob 的建筑，因为 heights[0] < heights[7] 。
第二个查询中，Alice 和 Bob 可以移动到建筑 6 ，因为 heights[3] < heights[6] 且 heights[5] < heights[6] 。
第三个查询中，Alice 无法与 Bob 相遇，因为 Bob 不能移动到任何其他建筑。
第四个查询中，Alice 和 Bob 可以移动到建筑 4 ，因为 heights[3] < heights[4] 且 heights[0] < heights[4] 。
第五个查询中，Alice 可以直接移动到 Bob 的建筑，因为 heights[1] < heights[6] 。
对于 ans[i] != -1 ，ans[i] 是 Alice 和 Bob 可以相遇的建筑中最左边建筑的下标。
对于 ans[i] == -1 ，不存在 Alice 和 Bob 可以相遇的建筑。

提示：

1 <= heights.length <= 5 * 104
1 <= heights[i] <= 109
1 <= queries.length <= 5 * 104
queries[i] = [ai, bi]
0 <= ai, bi <= heights.length - 1
"""
class Solution:
    def leftmostBuildingQueries(self, heights: List[int], queries: List[List[int]]) -> List[int]:

给你一个下标从 0开始的正整数数组heights，其中heights[i]表示第 i栋建筑的高度。
如果一个人在建筑i，且存在i < j的建筑j满足heights[i] < heights[j]，那么这个人可以移动到建筑j。
给你另外一个数组queries，其中queries[i] = [ai, bi]。第i个查询中，Alice 在建筑ai ，Bob 在建筑bi。
请你能返回一个数组ans，其中ans[i]是第i个查询中，Alice 和 Bob 可以相遇的最左边的建筑。如果对于查询i，Alice 和 Bob 不能相遇，令ans[i] 为-1。

示例 1：

输入：heights = [6,4,8,5,2,7], queries = [[0,1],[0,3],[2,4],[3,4],[2,2]]
输出：[2,5,-1,5,2]
解释：第一个查询中，Alice 和 Bob 可以移动到建筑 2 ，因为 heights[0] < heights[2] 且 heights[1] < heights[2] 。
第二个查询中，Alice 和 Bob 可以移动到建筑 5 ，因为 heights[0] < heights[5] 且 heights[3] < heights[5] 。
第三个查询中，Alice 无法与 Bob 相遇，因为 Alice 不能移动到任何其他建筑。
第四个查询中，Alice 和 Bob 可以移动到建筑 5 ，因为 heights[3] < heights[5] 且 heights[4] < heights[5] 。
第五个查询中，Alice 和 Bob 已经在同一栋建筑中。
对于 ans[i] != -1 ，ans[i] 是 Alice 和 Bob 可以相遇的建筑中最左边建筑的下标。
对于 ans[i] == -1 ，不存在 Alice 和 Bob 可以相遇的建筑。

示例 2：

输入：heights = [5,3,8,2,6,1,4,6], queries = [[0,7],[3,5],[5,2],[3,0],[1,6]]
输出：[7,6,-1,4,6]
解释：第一个查询中，Alice 可以直接移动到 Bob 的建筑，因为 heights[0] < heights[7] 。
第二个查询中，Alice 和 Bob 可以移动到建筑 6 ，因为 heights[3] < heights[6] 且 heights[5] < heights[6] 。
第三个查询中，Alice 无法与 Bob 相遇，因为 Bob 不能移动到任何其他建筑。
第四个查询中，Alice 和 Bob 可以移动到建筑 4 ，因为 heights[3] < heights[4] 且 heights[0] < heights[4] 。
第五个查询中，Alice 可以直接移动到 Bob 的建筑，因为 heights[1] < heights[6] 。
对于 ans[i] != -1 ，ans[i] 是 Alice 和 Bob 可以相遇的建筑中最左边建筑的下标。
对于 ans[i] == -1 ，不存在 Alice 和 Bob 可以相遇的建筑。

提示：

1 <= heights.length <= 5 * 104
1 <= heights[i] <= 109
1 <= queries.length <= 5 * 104
queries[i] = [ai, bi]
0 <= ai, bi <= heights.length - 1

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

```


maximum-strong-pair-xor-i

Maximum Strong Pair XOR I

Prompt:
"""
给你一个下标从 0 开始的整数数组 nums 。如果一对整数 x 和 y 满足以下条件，则称其为 强数对 ：

|x - y| <= min(x, y)

你需要从 nums 中选出两个整数，且满足：这两个整数可以形成一个强数对，并且它们的按位异或（XOR）值是在该数组所有强数对中的 最大值 。
返回数组 nums 所有可能的强数对中的 最大 异或值。
注意，你可以选择同一个整数两次来形成一个强数对。

示例 1：

输入：nums = [1,2,3,4,5]
输出：7
解释：数组 nums 中有 11 个强数对：(1, 1), (1, 2), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5) 和 (5, 5) 。
这些强数对中的最大异或值是 3 XOR 4 = 7 。

示例 2：

输入：nums = [10,100]
输出：0
解释：数组 nums 中有 2 个强数对：(10, 10) 和 (100, 100) 。
这些强数对中的最大异或值是 10 XOR 10 = 0 ，数对 (100, 100) 的异或值也是 100 XOR 100 = 0 。

示例 3：

输入：nums = [5,6,25,30]
输出：7
解释：数组 nums 中有 6 个强数对：(5, 5), (5, 6), (6, 6), (25, 25), (25, 30) 和 (30, 30) 。
这些强数对中的最大异或值是 25 XOR 30 = 7 ；另一个异或值非零的数对是 (5, 6) ，其异或值是 5 XOR 6 = 3 。

提示：

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

给你一个下标从 0 开始的整数数组 nums 。如果一对整数 x 和 y 满足以下条件，则称其为 强数对 ：

|x - y| <= min(x, y)

你需要从 nums 中选出两个整数，且满足：这两个整数可以形成一个强数对，并且它们的按位异或（XOR）值是在该数组所有强数对中的 最大值 。
返回数组 nums 所有可能的强数对中的 最大 异或值。
注意，你可以选择同一个整数两次来形成一个强数对。

示例 1：

输入：nums = [1,2,3,4,5]
输出：7
解释：数组 nums 中有 11 个强数对：(1, 1), (1, 2), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5) 和 (5, 5) 。
这些强数对中的最大异或值是 3 XOR 4 = 7 。

示例 2：

输入：nums = [10,100]
输出：0
解释：数组 nums 中有 2 个强数对：(10, 10) 和 (100, 100) 。
这些强数对中的最大异或值是 10 XOR 10 = 0 ，数对 (100, 100) 的异或值也是 100 XOR 100 = 0 。

示例 3：

输入：nums = [5,6,25,30]
输出：7
解释：数组 nums 中有 6 个强数对：(5, 5), (5, 6), (6, 6), (25, 25), (25, 30) 和 (30, 30) 。
这些强数对中的最大异或值是 25 XOR 30 = 7 ；另一个异或值非零的数对是 (5, 6) ，其异或值是 5 XOR 6 = 3 。

提示：

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

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

```

my_solution = Solution()

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

test_input = { "nums": [10,100] }
assert my_solution.maximumStrongPairXor(**test_input) == 0

test_input = { "nums": [5,6,25,30] }
assert my_solution.maximumStrongPairXor(**test_input) == 7

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

test_input = { "nums": [100] }
assert my_solution.maximumStrongPairXor(**test_input) == 0

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

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

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

test_input = { "nums": [1,1,6,6,9] }
assert my_solution.maximumStrongPairXor(**test_input) == 15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [1,5,9,10,4] }
assert my_solution.maximumStrongPairXor(**test_input) == 15

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

test_input = { "nums": [1,6,3,3,10] }
assert my_solution.maximumStrongPairXor(**test_input) == 12

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

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

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

test_input = { "nums": [1,6,6,1,9] }
assert my_solution.maximumStrongPairXor(**test_input) == 15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [1,9,9,7,6] }
assert my_solution.maximumStrongPairXor(**test_input) == 15

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

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

test_input = { "nums": [1,10,8,7,2] }
assert my_solution.maximumStrongPairXor(**test_input) == 15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

test_input = { "nums": [2,5,9,8,9] }
assert my_solution.maximumStrongPairXor(**test_input) == 13

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

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

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

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

test_input = { "nums": [2,6,8,6,10] }
assert my_solution.maximumStrongPairXor(**test_input) == 14

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

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

test_input = { "nums": [2,7,2,8,10] }
assert my_solution.maximumStrongPairXor(**test_input) == 15

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

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

test_input = { "nums": [2,7,9,2,6] }
assert my_solution.maximumStrongPairXor(**test_input) == 15

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

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

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

test_input = { "nums": [2,9,1,7,7] }
assert my_solution.maximumStrongPairXor(**test_input) == 14

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

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


high-access-employees

High-Access Employees

Prompt:
"""
给你一个长度为 n 、下标从 0 开始的二维字符串数组 access_times 。对于每个 i（0 <= i <= n - 1 ），access_times[i][0] 表示某位员工的姓名，access_times[i][1] 表示该员工的访问时间。access_times 中的所有条目都发生在同一天内。
访问时间用 四位 数字表示， 符合 24 小时制 ，例如 "0800" 或 "2250" 。
如果员工在 同一小时内 访问系统 三次或更多 ，则称其为 高访问 员工。
时间间隔正好相差一小时的时间 不 被视为同一小时内。例如，"0815" 和 "0915" 不属于同一小时内。
一天开始和结束时的访问时间不被计算为同一小时内。例如，"0005" 和 "2350" 不属于同一小时内。
以列表形式，按任意顺序，返回所有 高访问 员工的姓名。

示例 1：

输入：access_times = [["a","0549"],["b","0457"],["a","0532"],["a","0621"],["b","0540"]]
输出：["a"]
解释："a" 在时间段 [05:32, 06:31] 内有三条访问记录，时间分别为 05:32 、05:49 和 06:21 。
但是 "b" 的访问记录只有两条。
因此，答案是 ["a"] 。
示例 2：

输入：access_times = [["d","0002"],["c","0808"],["c","0829"],["e","0215"],["d","1508"],["d","1444"],["d","1410"],["c","0809"]]
输出：["c","d"]
解释："c" 在时间段 [08:08, 09:07] 内有三条访问记录，时间分别为 08:08 、08:09 和 08:29 。
"d" 在时间段 [14:10, 15:09] 内有三条访问记录，时间分别为 14:10 、14:44 和 15:08 。
然而，"e" 只有一条访问记录，因此不能包含在答案中，最终答案是 ["c","d"] 。
示例 3：

输入：access_times = [["cd","1025"],["ab","1025"],["cd","1046"],["cd","1055"],["ab","1124"],["ab","1120"]]
输出：["ab","cd"]
解释："ab"在时间段 [10:25, 11:24] 内有三条访问记录，时间分别为 10:25 、11:20 和 11:24 。
"cd" 在时间段 [10:25, 11:24] 内有三条访问记录，时间分别为 10:25 、10:46 和 10:55 。
因此，答案是 ["ab","cd"] 。

提示：

1 <= access_times.length <= 100
access_times[i].length == 2
1 <= access_times[i][0].length <= 10
access_times[i][0] 仅由小写英文字母组成。
access_times[i][1].length == 4
access_times[i][1] 采用24小时制表示时间。
access_times[i][1] 仅由数字 '0' 到 '9' 组成。
"""
class Solution:
    def findHighAccessEmployees(self, access_times: List[List[str]]) -> List[str]:

给你一个长度为 n 、下标从 0 开始的二维字符串数组 access_times 。对于每个 i（0 <= i <= n - 1 ），access_times[i][0] 表示某位员工的姓名，access_times[i][1] 表示该员工的访问时间。access_times 中的所有条目都发生在同一天内。
访问时间用 四位 数字表示， 符合 24 小时制 ，例如 "0800" 或 "2250" 。
如果员工在 同一小时内 访问系统 三次或更多 ，则称其为 高访问 员工。
时间间隔正好相差一小时的时间 不 被视为同一小时内。例如，"0815" 和 "0915" 不属于同一小时内。
一天开始和结束时的访问时间不被计算为同一小时内。例如，"0005" 和 "2350" 不属于同一小时内。
以列表形式，按任意顺序，返回所有 高访问 员工的姓名。

示例 1：

输入：access_times = [["a","0549"],["b","0457"],["a","0532"],["a","0621"],["b","0540"]]
输出：["a"]
解释："a" 在时间段 [05:32, 06:31] 内有三条访问记录，时间分别为 05:32 、05:49 和 06:21 。
但是 "b" 的访问记录只有两条。
因此，答案是 ["a"] 。
示例 2：

输入：access_times = [["d","0002"],["c","0808"],["c","0829"],["e","0215"],["d","1508"],["d","1444"],["d","1410"],["c","0809"]]
输出：["c","d"]
解释："c" 在时间段 [08:08, 09:07] 内有三条访问记录，时间分别为 08:08 、08:09 和 08:29 。
"d" 在时间段 [14:10, 15:09] 内有三条访问记录，时间分别为 14:10 、14:44 和 15:08 。
然而，"e" 只有一条访问记录，因此不能包含在答案中，最终答案是 ["c","d"] 。
示例 3：

输入：access_times = [["cd","1025"],["ab","1025"],["cd","1046"],["cd","1055"],["ab","1124"],["ab","1120"]]
输出：["ab","cd"]
解释："ab"在时间段 [10:25, 11:24] 内有三条访问记录，时间分别为 10:25 、11:20 和 11:24 。
"cd" 在时间段 [10:25, 11:24] 内有三条访问记录，时间分别为 10:25 、10:46 和 10:55 。
因此，答案是 ["ab","cd"] 。

提示：

1 <= access_times.length <= 100
access_times[i].length == 2
1 <= access_times[i][0].length <= 10
access_times[i][0] 仅由小写英文字母组成。
access_times[i][1].length == 4
access_times[i][1] 采用24小时制表示时间。
access_times[i][1] 仅由数字 '0' 到 '9' 组成。

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

```

my_solution = Solution()

test_input = { "access_times": [["a","0549"],["b","0457"],["a","0532"],["a","0621"],["b","0540"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["a"]

test_input = { "access_times": [["d","0002"],["c","0808"],["c","0829"],["e","0215"],["d","1508"],["d","1444"],["d","1410"],["c","0809"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["c","d"]

test_input = { "access_times": [["cd","1025"],["ab","1025"],["cd","1046"],["cd","1055"],["ab","1124"],["ab","1120"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["ab","cd"]

test_input = { "access_times": [["baipstt","1456"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["bouo","1126"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["cavfbqg","2304"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["cenjcq","1007"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["cqotrwqcaq","0131"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["downbuk","1951"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["dqsoiyz","2204"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["duzeyrov","0243"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["erfg","1223"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["fwhefd","2026"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["gbefbne","0911"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["gp","1540"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["ht","1319"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["inahnsjdqz","1750"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["jwxvijxo","0851"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["kibwwvjuez","0716"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["lvry","0706"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["mbsyxxfzjf","0114"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["mlehvzqb","1620"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["mmgat","0516"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["mxatapbs","2240"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["mzxbgtfc","1531"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["nnhh","1445"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["o","1414"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["qaxqifxxww","1557"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["rjy","0200"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["sgpgh","0539"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["sxx","0325"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["tkvgcf","1645"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["ttk","0304"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["un","0833"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["vlifcdn","0731"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["w","2224"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["wkmehwsg","2023"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["y","1005"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["ynnale","1331"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["yt","0900"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["zbgzk","0527"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["a","0039"],["a","0042"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["ajhzcltqse","0605"],["ajhzcltqse","0558"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["cbaqsymoi","0001"],["cbaqsymoi","0004"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["df","1958"],["df","2002"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["dhmnhvou","0529"],["dhmnhvou","0531"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["epghzrog","0333"],["epghzrog","0333"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["gda","1529"],["gda","1534"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["gjhtgm","2207"],["gjhtgm","2156"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["gsd","2030"],["gsd","2046"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["gsstuktwm","1403"],["gsstuktwm","1357"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["h","2159"],["h","2203"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["hxrdffk","1736"],["hxrdffk","1724"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["iaxsnenx","2037"],["iaxsnenx","2050"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["ikwjvflxq","0055"],["ikwjvflxq","0056"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["jkgjmku","0743"],["jkgjmku","0754"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["jkw","0241"],["jkw","0235"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["jykugiprxf","1633"],["jykugiprxf","1641"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["kdxw","1338"],["kdxw","1336"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["kenltmrg","0932"],["kenltmrg","0941"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["kptjrr","1356"],["kptjrr","1349"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["mcd","1333"],["mcd","1325"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["mhkizga","1552"],["mhkizga","1551"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["monxm","1748"],["monxm","1742"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["msjydtinfy","1301"],["msjydtinfy","1245"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["myhdmu","1407"],["myhdmu","1419"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["nyoezc","1050"],["nyoezc","1041"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["oksvrskxch","0053"],["oksvrskxch","0111"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["pxc","1915"],["pxc","1910"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["qedxyj","0609"],["qedxyj","0614"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["qmslkyxnph","0946"],["qmslkyxnph","0958"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["r","0206"],["r","0202"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["r","2041"],["r","2052"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["rf","2205"],["rf","2203"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["rswegeuhqd","0235"],["rswegeuhqd","0238"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["skfgl","0718"],["skfgl","0712"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["smnnl","2329"],["smnnl","2340"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["tpbbxpx","0409"],["tpbbxpx","0408"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["uiqxqp","0515"],["uiqxqp","0516"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["uyuz","1530"],["uyuz","1543"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["vfeunkee","1500"],["vfeunkee","1508"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["wbyd","1848"],["wbyd","1839"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["x","0522"],["x","0506"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["xhrhdy","1455"],["xhrhdy","1454"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["xmsypay","1605"],["xmsypay","1612"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["xy","0015"],["xy","0021"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["ydtnnpzw","0516"],["ydtnnpzw","0520"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["zh","2348"],["zh","2334"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["zinywjn","0017"],["zinywjn","0019"]] }
assert my_solution.findHighAccessEmployees(**test_input) == []

test_input = { "access_times": [["aczdfmsd","0317"],["aczdfmsd","0314"],["aczdfmsd","0320"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["aczdfmsd"]

test_input = { "access_times": [["bsluadumi","1518"],["bsluadumi","1516"],["bsluadumi","1510"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["bsluadumi"]

test_input = { "access_times": [["ckrdpxq","1122"],["ckrdpxq","1125"],["ckrdpxq","1121"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["ckrdpxq"]

test_input = { "access_times": [["fe","1320"],["fe","1326"],["fe","1331"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["fe"]

test_input = { "access_times": [["ff","1508"],["ff","1508"],["ff","1516"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["ff"]

test_input = { "access_times": [["fnlmbcedu","0052"],["fnlmbcedu","0103"],["fnlmbcedu","0055"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["fnlmbcedu"]

test_input = { "access_times": [["hffgwjjve","0159"],["hffgwjjve","0152"],["hffgwjjve","0159"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["hffgwjjve"]

test_input = { "access_times": [["ivlvfgwsx","0122"],["ivlvfgwsx","0135"],["ivlvfgwsx","0139"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["ivlvfgwsx"]

test_input = { "access_times": [["jlfnksqlt","0304"],["jlfnksqlt","0252"],["jlfnksqlt","0304"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["jlfnksqlt"]

test_input = { "access_times": [["jy","0647"],["jy","0652"],["jy","0704"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["jy"]

test_input = { "access_times": [["kchzzdso","2329"],["kchzzdso","2326"],["kchzzdso","2329"]] }
assert my_solution.findHighAccessEmployees(**test_input) == ["kchzzdso"]


minimum-operations-to-maximize-last-elements-in-arrays

Minimum Operations to Maximize Last Elements in Arrays

Prompt:
"""
给你两个下标从 0 开始的整数数组 nums1 和 nums2 ，这两个数组的长度都是 n 。
你可以执行一系列 操作（可能不执行）。
在每次操作中，你可以选择一个在范围 [0, n - 1] 内的下标 i ，并交换 nums1[i] 和 nums2[i] 的值。
你的任务是找到满足以下条件所需的 最小 操作次数：

nums1[n - 1] 等于 nums1 中所有元素的 最大值 ，即 nums1[n - 1] = max(nums1[0], nums1[1], ..., nums1[n - 1]) 。
nums2[n - 1] 等于 nums2 中所有元素的 最大值 ，即 nums2[n - 1] = max(nums2[0], nums2[1], ..., nums2[n - 1]) 。

以整数形式，表示并返回满足上述 全部 条件所需的 最小 操作次数，如果无法同时满足两个条件，则返回 -1 。

示例 1：

输入：nums1 = [1,2,7]，nums2 = [4,5,3]
输出：1
解释：在这个示例中，可以选择下标 i = 2 执行一次操作。
交换 nums1[2] 和 nums2[2] 的值，nums1 变为 [1,2,3] ，nums2 变为 [4,5,7] 。
同时满足两个条件。
可以证明，需要执行的最小操作次数为 1 。
因此，答案是 1 。

示例 2：

输入：nums1 = [2,3,4,5,9]，nums2 = [8,8,4,4,4]
输出：2
解释：在这个示例中，可以执行以下操作：
首先，选择下标 i = 4 执行操作。
交换 nums1[4] 和 nums2[4] 的值，nums1 变为 [2,3,4,5,4] ，nums2 变为 [8,8,4,4,9] 。
然后，选择下标 i = 3 执行操作。
交换 nums1[3] 和 nums2[3] 的值，nums1 变为 [2,3,4,4,4] ，nums2 变为 [8,8,4,5,9] 。
同时满足两个条件。
可以证明，需要执行的最小操作次数为 2 。
因此，答案是 2 。

示例 3：

输入：nums1 = [1,5,4]，nums2 = [2,5,3]
输出：-1
解释：在这个示例中，无法同时满足两个条件。
因此，答案是 -1 。

提示：

1 <= n == nums1.length == nums2.length <= 1000
1 <= nums1[i] <= 109
1 <= nums2[i] <= 109
"""
class Solution:
    def minOperations(self, nums1: List[int], nums2: List[int]) -> int:

给你两个下标从 0 开始的整数数组 nums1 和 nums2 ，这两个数组的长度都是 n 。
你可以执行一系列 操作（可能不执行）。
在每次操作中，你可以选择一个在范围 [0, n - 1] 内的下标 i ，并交换 nums1[i] 和 nums2[i] 的值。
你的任务是找到满足以下条件所需的 最小 操作次数：

nums1[n - 1] 等于 nums1 中所有元素的 最大值 ，即 nums1[n - 1] = max(nums1[0], nums1[1], ..., nums1[n - 1]) 。
nums2[n - 1] 等于 nums2 中所有元素的 最大值 ，即 nums2[n - 1] = max(nums2[0], nums2[1], ..., nums2[n - 1]) 。

以整数形式，表示并返回满足上述 全部 条件所需的 最小 操作次数，如果无法同时满足两个条件，则返回 -1 。

示例 1：

输入：nums1 = [1,2,7]，nums2 = [4,5,3]
输出：1
解释：在这个示例中，可以选择下标 i = 2 执行一次操作。
交换 nums1[2] 和 nums2[2] 的值，nums1 变为 [1,2,3] ，nums2 变为 [4,5,7] 。
同时满足两个条件。
可以证明，需要执行的最小操作次数为 1 。
因此，答案是 1 。

示例 2：

输入：nums1 = [2,3,4,5,9]，nums2 = [8,8,4,4,4]
输出：2
解释：在这个示例中，可以执行以下操作：
首先，选择下标 i = 4 执行操作。
交换 nums1[4] 和 nums2[4] 的值，nums1 变为 [2,3,4,5,4] ，nums2 变为 [8,8,4,4,9] 。
然后，选择下标 i = 3 执行操作。
交换 nums1[3] 和 nums2[3] 的值，nums1 变为 [2,3,4,4,4] ，nums2 变为 [8,8,4,5,9] 。
同时满足两个条件。
可以证明，需要执行的最小操作次数为 2 。
因此，答案是 2 。

示例 3：

输入：nums1 = [1,5,4]，nums2 = [2,5,3]
输出：-1
解释：在这个示例中，无法同时满足两个条件。
因此，答案是 -1 。

提示：

1 <= n == nums1.length == nums2.length <= 1000
1 <= nums1[i] <= 109
1 <= nums2[i] <= 109

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

```

my_solution = Solution()

test_input = { "nums1": [1,2,7], "nums2": [4,5,3] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [2,3,4,5,9], "nums2": [8,8,4,4,4] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [1,5,4], "nums2": [2,5,3] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [1], "nums2": [1] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,2], "nums2": [2,1] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [1,1,10], "nums2": [1,5,1] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [1,4,16], "nums2": [16,16,16] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,5,15], "nums2": [1,1,1] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [2,5,7], "nums2": [2,2,2] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [8,9,10], "nums2": [10,9,9] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [9,14,14], "nums2": [14,11,14] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [16,16,16], "nums2": [6,7,16] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [19,7,19], "nums2": [5,19,19] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,1,8,9], "nums2": [1,7,1,1] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [1,5,9,9], "nums2": [9,9,8,9] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,7,7,7], "nums2": [7,3,3,7] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [10,18,12,12], "nums2": [19,6,5,12] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [12,9,11,12], "nums2": [3,9,9,9] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [15,54,22,54], "nums2": [54,19,54,54] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [20,20,20,20], "nums2": [5,8,19,20] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,3,4,6,7], "nums2": [1,1,1,1,1] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,11,17,1,18], "nums2": [1,1,1,18,1] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [3,3,3,14,14], "nums2": [3,3,4,3,3] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [4,4,8,4,17], "nums2": [4,8,4,14,4] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [4,12,11,11,12], "nums2": [12,6,12,12,12] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [6,21,87,63,87], "nums2": [87,87,23,63,63] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [10,6,6,6,10], "nums2": [6,6,10,10,6] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [16,12,15,15,16], "nums2": [8,16,16,15,15] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [17,3,6,6,17], "nums2": [3,17,6,14,6] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [19,13,18,18,19], "nums2": [5,13,13,13,13] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [20,20,53,20,68], "nums2": [20,28,20,61,20] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [6,6,2,4,4,6], "nums2": [1,1,6,4,4,4] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [8,6,6,6,7,8], "nums2": [5,8,8,8,7,7] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [15,1,15,6,12,15], "nums2": [1,15,2,15,15,15] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [17,13,19,9,6,14], "nums2": [17,14,15,1,19,19] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [20,8,10,12,17,20], "nums2": [7,20,20,20,20,20] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [20,18,15,11,17,20], "nums2": [7,15,13,7,20,12] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [20,20,20,20,19,20], "nums2": [3,6,7,15,20,20] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [28,43,79,32,40,3], "nums2": [95,25,74,16,82,56] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [29,81,58,99,41,36], "nums2": [15,34,47,57,31,95] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [1,1,4,1,7,1,15], "nums2": [1,1,1,4,1,9,1] }
assert my_solution.minOperations(**test_input) == 2

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

test_input = { "nums1": [2,88,17,88,68,68,88], "nums2": [88,16,88,68,68,68,68] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [3,3,5,3,3,3,18], "nums2": [3,4,3,11,13,14,3] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [3,41,98,71,71,71,98], "nums2": [98,98,49,71,85,94,71] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [5,5,27,53,5,59,65], "nums2": [5,16,5,5,58,5,5] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [5,6,11,11,13,11,14], "nums2": [14,14,11,11,11,14,11] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [6,5,1,10,8,4,5], "nums2": [3,8,8,3,6,1,4] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [14,3,4,4,4,4,14], "nums2": [2,14,4,4,5,12,4] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [14,28,68,68,65,67,68], "nums2": [68,68,49,64,68,67,67] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [19,19,8,9,10,13,19], "nums2": [1,5,19,19,19,13,13] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [20,6,20,20,20,20,20], "nums2": [3,20,7,9,13,14,20] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [85,85,62,85,78,84,85], "nums2": [5,37,85,76,85,85,85] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,2,2,2,2,2,2,10], "nums2": [10,2,2,2,7,8,9,2] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [1,9,3,3,4,9,9,9], "nums2": [9,2,9,9,9,6,8,9] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [3,3,4,3,3,3,3,8], "nums2": [3,3,3,5,7,7,8,3] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [4,8,11,19,16,16,19,19], "nums2": [19,19,19,13,16,16,16,16] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [8,20,4,9,9,4,4,20], "nums2": [9,14,10,1,1,20,16,15] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [9,9,1,2,2,6,8,9], "nums2": [1,1,9,2,2,2,2,2] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [10,4,10,9,10,10,10,10], "nums2": [4,10,9,9,9,9,9,9] }
assert my_solution.minOperations(**test_input) == 1

test_input = { "nums1": [13,95,19,56,59,95,95,95], "nums2": [95,14,95,95,95,83,88,95] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [19,7,19,8,9,15,9,19], "nums2": [7,19,7,19,9,9,18,9] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [19,19,3,3,15,16,3,19], "nums2": [2,2,3,7,3,3,17,3] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [1,8,8,5,8,8,8,7,8], "nums2": [8,2,4,8,5,6,6,8,8] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,10,10,5,10,8,10,10,10], "nums2": [10,2,4,10,7,8,8,8,8] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [2,7,7,7,7,7,7,17,18], "nums2": [18,7,10,11,13,15,17,7,7] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [3,13,22,24,13,13,13,81,91], "nums2": [91,13,13,13,45,59,71,13,13] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [4,4,9,4,16,4,17,4,18], "nums2": [4,8,4,14,4,16,4,18,4] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [6,9,65,13,65,65,28,28,65], "nums2": [65,65,13,65,24,27,28,34,28] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [8,3,5,6,6,3,3,3,8], "nums2": [1,3,3,3,3,7,7,8,3] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [10,1,10,10,10,9,9,9,10], "nums2": [1,10,5,6,8,9,9,10,9] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [15,15,3,5,15,15,9,13,15], "nums2": [1,2,15,15,6,8,9,9,9] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [16,3,3,7,3,11,3,3,16], "nums2": [2,3,6,3,10,3,15,16,3] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [16,3,16,7,16,16,10,10,16], "nums2": [2,16,4,16,9,10,10,13,10] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [80,80,18,39,39,62,39,39,80], "nums2": [2,10,80,39,42,39,66,66,39] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [1,1,1,1,1,1,1,7,1,9], "nums2": [9,1,3,3,3,5,5,1,9,1] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [1,2,2,2,2,5,8,2,2,9], "nums2": [9,2,2,2,4,2,2,9,9,2] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [1,2,18,18,10,18,18,17,18,18], "nums2": [18,18,5,5,18,13,14,18,18,18] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [1,3,1,1,1,1,16,16,1,19], "nums2": [1,1,7,7,9,12,1,1,18,1] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [1,9,3,9,4,5,7,8,8,9], "nums2": [9,1,9,3,9,9,7,7,7,7] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [2,2,2,2,10,11,2,2,2,20], "nums2": [2,3,9,9,2,2,12,14,19,2] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [3,15,6,7,7,10,7,7,15,15], "nums2": [15,6,15,7,9,7,12,13,7,7] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [5,20,20,8,8,12,20,19,20,20], "nums2": [20,6,7,20,20,20,15,20,20,20] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [8,8,8,8,8,8,8,8,6,8], "nums2": [1,2,3,4,4,5,5,5,8,8] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [9,3,3,3,3,6,7,7,3,9], "nums2": [3,3,4,5,5,3,3,3,7,3] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [9,8,6,2,1,10,9,7,9,4], "nums2": [6,2,8,2,5,3,6,5,6,10] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [10,2,2,2,3,2,2,2,2,10], "nums2": [1,10,2,2,2,6,6,8,10,2] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [12,19,10,4,17,12,18,6,7,7], "nums2": [20,5,15,7,10,8,2,16,14,1] }
assert my_solution.minOperations(**test_input) == -1

test_input = { "nums1": [17,31,31,34,31,42,31,65,31,89], "nums2": [89,31,32,31,37,31,45,31,84,31] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [19,7,7,19,9,19,19,19,17,19], "nums2": [6,19,19,8,19,10,10,16,19,19] }
assert my_solution.minOperations(**test_input) == 0

test_input = { "nums1": [20,20,7,20,8,11,11,11,11,20], "nums2": [5,6,20,7,20,11,15,18,20,11] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [90,7,90,13,90,33,33,83,33,90], "nums2": [6,90,13,90,22,33,62,33,86,33] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [1,1,1,1,1,10,1,15,16,17,20], "nums2": [1,2,2,9,10,1,14,1,1,1,1] }
assert my_solution.minOperations(**test_input) == 5

test_input = { "nums1": [1,1,1,1,3,1,1,6,1,1,8], "nums2": [1,1,1,3,1,3,5,1,6,7,1] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [1,2,2,6,2,2,2,2,2,2,10], "nums2": [10,2,4,2,6,6,7,8,9,9,2] }
assert my_solution.minOperations(**test_input) == 2

test_input = { "nums1": [1,2,3,20,8,8,19,19,19,20,20], "nums2": [20,20,20,5,20,20,20,19,19,19,19] }
assert my_solution.minOperations(**test_input) == 3

test_input = { "nums1": [1,2,4,9,5,9,9,6,7,6,9], "nums2": [9,9,9,4,9,5,5,6,6,7,6] }
assert my_solution.minOperations(**test_input) == 5

test_input = { "nums1": [1,7,7,7,7,7,13,16,7,19,19], "nums2": [19,7,10,11,11,12,7,7,16,7,7] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [1,10,4,10,10,10,6,10,7,9,10], "nums2": [10,3,10,5,5,6,10,7,10,9,9] }
assert my_solution.minOperations(**test_input) == 4

test_input = { "nums1": [1,20,20,7,20,20,13,17,17,19,20], "nums2": [20,2,4,20,7,7,20,20,17,17,17] }
assert my_solution.minOperations(**test_input) == 4


maximum-strong-pair-xor-ii

Maximum Strong Pair XOR II

Prompt:
"""
给你一个下标从 0 开始的整数数组 nums 。如果一对整数 x 和 y 满足以下条件，则称其为 强数对 ：

|x - y| <= min(x, y)

你需要从 nums 中选出两个整数，且满足：这两个整数可以形成一个强数对，并且它们的按位异或（XOR）值是在该数组所有强数对中的 最大值 。
返回数组 nums 所有可能的强数对中的 最大 异或值。
注意，你可以选择同一个整数两次来形成一个强数对。

示例 1：

输入：nums = [1,2,3,4,5]
输出：7
解释：数组 nums 中有 11 个强数对：(1, 1), (1, 2), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5) 和 (5, 5) 。
这些强数对中的最大异或值是 3 XOR 4 = 7 。

示例 2：

输入：nums = [10,100]
输出：0
解释：数组 nums 中有 2 个强数对：(10, 10) 和 (100, 100) 。
这些强数对中的最大异或值是 10 XOR 10 = 0 ，数对 (100, 100) 的异或值也是 100 XOR 100 = 0 。

示例 3：

输入：nums = [500,520,2500,3000]
输出：1020
解释：数组 nums 中有 6 个强数对：(500, 500), (500, 520), (520, 520), (2500, 2500), (2500, 3000) 和 (3000, 3000) 。
这些强数对中的最大异或值是 500 XOR 520 = 1020 ；另一个异或值非零的数对是 (5, 6) ，其异或值是 2500 XOR 3000 = 636 。

提示：

1 <= nums.length <= 5 * 104
1 <= nums[i] <= 220 - 1
"""
class Solution:
    def maximumStrongPairXor(self, nums: List[int]) -> int:

给你一个下标从 0 开始的整数数组 nums 。如果一对整数 x 和 y 满足以下条件，则称其为 强数对 ：

|x - y| <= min(x, y)

你需要从 nums 中选出两个整数，且满足：这两个整数可以形成一个强数对，并且它们的按位异或（XOR）值是在该数组所有强数对中的 最大值 。
返回数组 nums 所有可能的强数对中的 最大 异或值。
注意，你可以选择同一个整数两次来形成一个强数对。

示例 1：

输入：nums = [1,2,3,4,5]
输出：7
解释：数组 nums 中有 11 个强数对：(1, 1), (1, 2), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5) 和 (5, 5) 。
这些强数对中的最大异或值是 3 XOR 4 = 7 。

示例 2：

输入：nums = [10,100]
输出：0
解释：数组 nums 中有 2 个强数对：(10, 10) 和 (100, 100) 。
这些强数对中的最大异或值是 10 XOR 10 = 0 ，数对 (100, 100) 的异或值也是 100 XOR 100 = 0 。

示例 3：

输入：nums = [500,520,2500,3000]
输出：1020
解释：数组 nums 中有 6 个强数对：(500, 500), (500, 520), (520, 520), (2500, 2500), (2500, 3000) 和 (3000, 3000) 。
这些强数对中的最大异或值是 500 XOR 520 = 1020 ；另一个异或值非零的数对是 (5, 6) ，其异或值是 2500 XOR 3000 = 636 。

提示：

1 <= nums.length <= 5 * 104
1 <= nums[i] <= 220 - 1

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

```

my_solution = Solution()

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

test_input = { "nums": [10,100] }
assert my_solution.maximumStrongPairXor(**test_input) == 0

test_input = { "nums": [500,520,2500,3000] }
assert my_solution.maximumStrongPairXor(**test_input) == 1020

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


distribute-candies-among-children-i

Distribute Candies Among Children I

Prompt:
"""
给你两个正整数 n 和 limit 。

请你将 n 颗糖果分给 3 位小朋友，确保没有任何小朋友得到超过 limit 颗糖果，请你返回满足此条件下的 总方案数 。

示例 1：

输入：n = 5, limit = 2
输出：3
解释：总共有 3 种方法分配 5 颗糖果，且每位小朋友的糖果数不超过 2 ：(1, 2, 2) ，(2, 1, 2) 和 (2, 2, 1) 。

示例 2：

输入：n = 3, limit = 3
输出：10
解释：总共有 10 种方法分配 3 颗糖果，且每位小朋友的糖果数不超过 3 ：(0, 0, 3) ，(0, 1, 2) ，(0, 2, 1) ，(0, 3, 0) ，(1, 0, 2) ，(1, 1, 1) ，(1, 2, 0) ，(2, 0, 1) ，(2, 1, 0) 和 (3, 0, 0) 。

提示：

 * 1 <= n <= 50
 * 1 <= limit <= 50
"""
class Solution:
    def distributeCandies(self, n: int, limit: int) -> int:

给你两个正整数 n 和 limit 。

请你将 n 颗糖果分给 3 位小朋友，确保没有任何小朋友得到超过 limit 颗糖果，请你返回满足此条件下的 总方案数 。

示例 1：

输入：n = 5, limit = 2
输出：3
解释：总共有 3 种方法分配 5 颗糖果，且每位小朋友的糖果数不超过 2 ：(1, 2, 2) ，(2, 1, 2) 和 (2, 2, 1) 。

示例 2：

输入：n = 3, limit = 3
输出：10
解释：总共有 10 种方法分配 3 颗糖果，且每位小朋友的糖果数不超过 3 ：(0, 0, 3) ，(0, 1, 2) ，(0, 2, 1) ，(0, 3, 0) ，(1, 0, 2) ，(1, 1, 1) ，(1, 2, 0) ，(2, 0, 1) ，(2, 1, 0) 和 (3, 0, 0) 。

提示：

 * 1 <= n <= 50
 * 1 <= limit <= 50

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

```

my_solution = Solution()

test_input = { "n": 5, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 3, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 1, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 25 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 2, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 2, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 25 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 3, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 1

test_input = { "n": 3, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 7

test_input = { "n": 3, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 25 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 4, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 0

test_input = { "n": 4, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 4, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 12

test_input = { "n": 4, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 15