FunctionRacerProblemsRace

Convert to Hexadecimal

EasyMathPython, JavaScript, TypeScript, Java, C++

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems