a hacky solution


  • -2
    S

    The easiest way is to use Integer.toHexString()

    return Integer.toHexString(num);
    

    I know it is hacky, but it is what it is...


  • 0

    It's not hacky. It's againt the requirement.


  • 0
    D

    According to the instruction, "You must not use any method provided by the library which converts/formats the number to hex directly".


Log in to reply
 

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