Given an integer, return its base 7 string representation.
Input: 100 Output: "202"
Input: -7 Output: "-10"
Note: The input will be in range of [-1e7, 1e7].
class Solution:
def convertToBase7(self, num: int) -> str:
if num >= 7:
return self.convertToBase7(num // 7) + str(num % 7)
elif num < 0:
return '-' + self.convertToBase7(-num)
elif num < 7:
return str(num)