There is a problem in java solution

  • 9

    int in java is 32-bit signed number ,the maximum signed number is 2147483647.when the last bit of the input number is '1' and we reverse bits,it will become negative number ,how can we return a positive int number and the number must be larger than 2147483647?

  • 0

    Just ignore the number and take a look at the bits after it when you are working on Java. Or, try Integer.toUnsignedString.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.