#504

Base 7

pupil · 445 · lc easy +26 · verified · 53.9% accepted · 886 likes · top 45%

play →

Description

Convert the integer num to base 7 and return the result as a string. The result should handle negative numbers correctly.

Example 1:

Input: num = 100
Output: "202"

Example 2:

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

Code

1
2
3