Solution
C++ []\nclass Solution {\n public:\n  string convertToBase7(int num) {\n    if (num < 0)\n      return "-" + convertToBase7(-num);\n    if (num < 7)\n      retu
```C++ []\nclass Solution {\n public:\n  string convertToBase7(int num) {\n    if (num < 0)\n      return "-" + convertToBase7(-num);\n    if (num < 7)\n      return to_string(num);\n    return convertToBase7(num / 7) + to_string(num % 7);\n  }\n};\n```\n\n```Python3 []\nclass Solution:\n    def convertToBase7(self, n: int) -> str:\n        num, s = abs(n), \'\'\n        while num:\n            num, remain = divmod(num,7)\n            s = str(remain) + s\n        return "-" * (n < 0) + s or "0"\n```\n\n```Java []\nclass Solution {\n    public String convertToBase7(int num) {\n       return Integer.toString(num, 7);\n    }\n}\n```\n
['C++', 'Java', 'Python3']