MAXXOR - Find the max XOR value
You have two integers L and R, and you are required to find the maximum xor value of a and b where L ≤ a ≤ R and L ≤ b ≤ R.
Input
Two integers in a line. L, R ≤ 109.
Output
One integer, the answer.
Example
Input: 1 10 Output: 15
hide comments
karthik1997:
2015-12-29 19:02:31
Ans is pow( 2,ceil( log2(r) ) )-1 . |
|
chirayu06:
2015-12-29 07:48:25
easy one Last edit: 2015-12-29 07:50:12 |
|
Diksha Jaiswal:
2015-12-29 07:44:34
easy |
|
coder096:
2015-12-28 20:46:41
weak test cases!
|
|
thedictator:
2015-12-24 07:36:46
nice one!!!! |
|
Bartosz:
2015-12-19 17:06:22
Good problem. I've enjoy it. |
|
ashish kumar:
2015-12-15 06:16:23
Nice and easy concept. |
|
anuveshkothari:
2015-12-12 19:00:07
learned something new |
|
:.Mohib.::
2015-12-11 08:46:38
Beautiful problem ! |
|
SCaffrey:
2015-12-03 14:13:20
This problem is quite easy. Challenge yourself! |
Added by: | SCaffrey |
Date: | 2015-12-03 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | https://www.hackerrank.com/challenges/maximizing-xor |