Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
|||||
2015-12-29 19:02:31
Ans is pow( 2,ceil( log2(r) ) )-1 . |
|||||
2015-12-29 07:48:25
easy one Last edit: 2015-12-29 07:50:12 |
|||||
2015-12-29 07:44:34 Diksha Jaiswal
easy |
|||||
2015-12-28 20:46:41
weak test cases! |
|||||
2015-12-24 07:36:46
nice one!!!! |
|||||
2015-12-19 17:06:22 Bartosz
Good problem. I've enjoy it. |
|||||
2015-12-15 06:16:23 ashish kumar
Nice and easy concept. |
|||||
2015-12-12 19:00:07
learned something new |
|||||
2015-12-11 08:46:38 :.Mohib.:
Beautiful problem ! |
|||||
2015-12-03 14:13:20 SCaffrey
This problem is quite easy. Challenge yourself! |