177. Convert a Number to Hexadecimal

Convert an integer num to a hexadecimal string (for negatives, use 32-bit two's complement).
Example 1
Input: num = 26
Output: "1a"
Explanation: 26 in hex is 1a.
Example 2
Input: num = -1
Output: "ffffffff"
Explanation: 32-bit representation of -1.
bit manipulationeasy
JavaScript
Loading...
Line 1, Char 1