Convert to Hexadecimal
Return the hexadecimal form of num as a string using lowercase letters a to f and no leading zeros (zero is "0").
For a negative num, use its 32 bit two's complement form, which is the same as num + 2**32.
Example 1
num 26
returns "1a"
"1a".
Example 2
num -1
returns "ffffffff"
"ffffffff".
Constraints
-231 <= num <= 231 - 1
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.