Description

Given an integer num, return a string of its base 7 representation. Handle negative numbers by including the negative sign.

Examples

Input:num = 100
Output:"202"
Explanation:

100 in base 7 is 202.

Input:num = -7
Output:"-10"
Explanation:

-7 in base 7 is -10, since 7 = 1*7 + 0. The negative sign is preserved.

Input:num = 0
Output:"0"
Explanation:

0 in any base is still 0, so 0 in base 7 is "0".

Constraints

  • -10⁷ ≤ num ≤ 10⁷

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!