Easy
Quiz
#405 Convert a Number to Hexadecimal
APPROACH
Given a 32-bit signed integer num, return its hexadecimal representation as a lowercase string. Negative values use two's complement, and the result must contain no leading zeros (except for the value 0 itself).
You may not use any built-in hexadecimal conversion function.
Example 1:
Input: num = 26
Output: "1a"
Example 2:
Input: num = -1
Output: "ffffffff"
1 of 4
1:00
What is the optimal approach for this problem?