recursion🔥
\nclass Solution {\n    string s = "";\npublic:\n    string convertToBase7(int num, bool flag = 0) {\n        if (num==0) {\n            if (s.size() == 0) s = 
```\nclass Solution {\n    string s = "";\npublic:\n    string convertToBase7(int num, bool flag = 0) {\n        if (num==0) {\n            if (s.size() == 0) s = "0";\n            else reverse(begin(s), end(s)); \n            return flag? "-"+s: s;\n        }\n\n        if (num<0) flag = 1;\n        s.push_back(abs(num)%7 + \'0\');\n\n        return convertToBase7(abs(num)/7, flag);\n    }\n};\n```
['C++']