Easy and simple c++ solution beats 100% 0ms Solution
Code\n\nclass Solution {\npublic:\n    string convertToBase7(int num) {\n        bool sign=0;\n        if(num<0){\n            sign=1;\n        }\n        num=a
# Code\n```\nclass Solution {\npublic:\n    string convertToBase7(int num) {\n        bool sign=0;\n        if(num<0){\n            sign=1;\n        }\n        num=abs(num);\n        string str="";\n        while(num>=7){\n            str+=num%7+48;\n            num/=7;\n        }\n        str+=num+48;\n        if(sign){\n            str+=\'-\';\n        }\n        reverse(str.begin(),str.end());\n        return str;\n    }\n};\n```
['C++']