3ms C++ 3 lines Solution
\n string convertToBase7(int num) {\n        int res = 0;\n        for(int i=0; num!=0; res += pow(10,i++)*(num % 7), num /= 7) {}\n        return to_string(res
````   \n string convertToBase7(int num) {\n        int res = 0;\n        for(int i=0; num!=0; res += pow(10,i++)*(num % 7), num /= 7) {}\n        return to_string(res);\n    }\n````
[]