T.C : O(logN) || EASY C++ Solution || CPP
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string convertToBase7(int num) {\n       if(num==0) return "0";\n       int n=abs(num);\n       string ans="";\n        while(n!=0){\n            ans+=(to_string(n%7));\n            n/=7;\n        }\n        if(num<0) ans+=\'-\';\n        reverse(ans.begin(),ans.end());\n        return ans;\n    }\n};\n```
['C++']