504_Base 7
Last updated
Last updated
Given an integer, return its base 7 string representation. The integer may be negative.
Example 1:
Example 2:
Idea:
Use a sequence of module and division operations.
The integer mod base 7 will be in the number in last digit, the integer divide base 7 is the next integer to run
record the sign at the beginning
Time Complexity: where 7 is the base, n is the input number
Space Complexity: where 7 is the base, n is the input number