Practice Maximum Xor Product
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Choose an integer x with 0 <= x < 2^n to maximize (a XOR x) * (b XOR x), where XOR is bitwise exclusive OR. Find the maximum product first, then return it modulo 10^9 + 7.
Source: Maximum Xor Product on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
a = 12, b = 5, n = 4
Output
98
# Example 2
Input
a = 6, b = 7 , n = 5
Output
930
# Example 3
Input
a = 1, b = 6, n = 3
Output
12
Constraints
0 <= a, b < 2^50
0 <= n <= 50
Related LeetCode Problems
Practice more problems similar to Maximum Xor Product.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.