Max XOR
Problem Overview
- Given integers lo, hi, and k, find two integers a and b with lo ≤ a < b ≤ hi that maximize a XOR b without exceeding k.
- Input: lo, hi, k (1 ≤ lo < hi ≤ 10^4, 1 ≤ k ≤ 10^4); Output: the maximum achievable XOR value.
- Domain: bitwise operations and range selection in integers.
- This coding interview problem is an interview question from Ibm interviews.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
