Algorithms
Medium
2939
3192
Maximum Xor Product
maximum-xor-product
"""
Given three integers a, b, and n, return the maximum value of (a XOR x) * (b XOR x) where 0 <= x < 2n.
Since the answer may be too large, return it modulo 109 + 7.
Note that XOR is the bitwise XOR operation.

Example 1:

Input: a = 12, b = 5, n = 4
Output: 98
Explanation: For x = 2, (a XOR x) = 14 and (b XOR x) = 7. Hence, (a XOR x) * (b XOR x) = 98. 
It can be shown that 98 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.

Example 2:

Input: a = 6, b = 7 , n = 5
Output: 930
Explanation: For x = 25, (a XOR x) = 31 and (b XOR x) = 30. Hence, (a XOR x) * (b XOR x) = 930.
It can be shown that 930 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.
Example 3:

Input: a = 1, b = 6, n = 3
Output: 12
Explanation: For x = 5, (a XOR x) = 4 and (b XOR x) = 3. Hence, (a XOR x) * (b XOR x) = 12.
It can be shown that 12 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.


Constraints:

0 <= a, b < 250
0 <= n <= 50
"""
class Solution:
    def maximumXorProduct(self, a: int, b: int, n: int) -> int:
        
Given three integers a, b, and n, return the maximum value of (a XOR x) * (b XOR x) where 0 <= x < 2n.
Since the answer may be too large, return it modulo 109 + 7.
Note that XOR is the bitwise XOR operation.

Example 1:

Input: a = 12, b = 5, n = 4
Output: 98
Explanation: For x = 2, (a XOR x) = 14 and (b XOR x) = 7. Hence, (a XOR x) * (b XOR x) = 98. 
It can be shown that 98 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.

Example 2:

Input: a = 6, b = 7 , n = 5
Output: 930
Explanation: For x = 25, (a XOR x) = 31 and (b XOR x) = 30. Hence, (a XOR x) * (b XOR x) = 930.
It can be shown that 930 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.
Example 3:

Input: a = 1, b = 6, n = 3
Output: 12
Explanation: For x = 5, (a XOR x) = 4 and (b XOR x) = 3. Hence, (a XOR x) * (b XOR x) = 12.
It can be shown that 12 is the maximum value of (a XOR x) * (b XOR x) for all 0 <= x < 2n.


Constraints:

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


Please complete the code below to solve above prblem:
```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