Is 0xFF is valid?

  • 0

    I think it's true. But most of AC answer is false.

  • 0

    There is no test case requiring that the accepted algorithm return true for hexadecimal numbers. I don't know if it is simply not tested, or if there is a case where it is a valid hexadecimal number and it expects false. Therefore, it's safer to simply view hexadecimal as not a valid number for the purposes of this problem.

    As a side note, it is allowed to have "3.54E9", so how do you tell the difference between exponential and not in hex? ("0x3.54E9" vs "0x3.54 * 16^9") Avoiding that problem is probably why hex is treated as invalid here.

Log in to reply

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