3-liner C++ to build string backward + 1-liner recursive solutions
Iterative Version: Note that the input n is guaranteed to be in range of [-1e7, 1e7] by the problem, so abs(n) won't overflow since n cannot be INT_MIN.\n\n    
**Iterative Version:** Note that the input `n` is guaranteed to be in range of [-1e7, 1e7] by the problem, so `abs(n)` won't overflow since `n` cannot be `INT_MIN`.\n```\n    string convertToBase7(int n) {\n      int x = abs(n); string res;\n      do res = to_string(x%7)+res; while(x/=7);\n      return (n>=0? "" : "-") + res;\n    }\n```\n**Recursive Version:**\n```\n    string convertToBase7(int n) {\n      return n>=0? n>=7? convertToBase7(n/7)+to_string(n%7) : to_string(n) : '-'+convertToBase7(-n);\n    }\n```
['String', 'C++']