Approach hintTry it first, then revealHide
Start from l and keep setting its lowest unset bit while the result stays within r. Setting low bits adds the least value per extra one bit, which also keeps the answer as small as possible.
Start from l and keep setting its lowest unset bit while the result stays within r. Setting low bits adds the least value per extra one bit, which also keeps the answer as small as possible.