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
nimphy:
2018-05-01 09:15:42
so what should do to solve it not using the formula??? |
|
anubhav1772:
2017-07-10 12:12:49
AC in One Go :)
|
|
sagar_zhcet:
2017-06-07 21:50:00
@karthik1997: try your formula for L=8 and R=10. your formula is wrong. |
|
praney_rai:
2017-01-26 16:42:27
weak test cases my code got ac. but for input 1 1 it shows 1 but ans should be 0. :D
|
|
narutorocks:
2016-06-10 18:44:17
Nice Question .Ignore the formula.Try on your own.
|
|
mkfeuhrer:
2016-06-07 22:09:06
don't use this formula.....its wrong for many cases...but it works here....use logic to get the beauty of ques. AC :-) |
|
vikke:
2016-04-16 21:34:21
awesome problem
|
|
topke:
2016-01-28 16:56:22
Yea very weak test cases that's why formula is passing. Try 100 120 i bet half of these solutions won't pass. Plus it would be nice from author to remove formula from comments. |
|
anil2496:
2016-01-04 21:00:34
weak test cases
|
|
Sayak Haldar:
2016-01-04 17:27:32
@karthik1997: your formula is actually wrong. Since, the testcases are weak your solution got AC (if you strictly follow the formula) |
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 |