Description
Given an integer num, return a string of its base 7 representation. Handle negative numbers by including the negative sign.
Examples
Input:
num = 100Output:
"202"Explanation:
100 in base 7 is 202.
Input:
num = -7Output:
"-10"Explanation:
-7 in base 7 is -10, since 7 = 1*7 + 0. The negative sign is preserved.
Input:
num = 0Output:
"0"Explanation:
0 in any base is still 0, so 0 in base 7 is "0".
Constraints
- •
-10⁷ ≤ num ≤ 10⁷