Beats 100% || Efficient Solution || Simple Logic 
ApproachObtaining every digit from the int(abs) and form a string ; Reverse it to obtain the result.Complexity
Time complexity:
Space complexity:

Code
# Approach
Obtaining every digit from the int(abs) and form a string ; Reverse it to obtain the result.

# Complexity
- Time complexity:
- Space complexity:
![Screenshot 2025-01-23 110733.png](https://assets.leetcode.com/users/images/5fa7cb62-369a-4bb9-9149-272ce9f075d6_1737610665.7129278.png)


<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
string str;
char sign; 
    string convertToBase7(int num) {
        if(num < 0) {num *= -1; sign='n';}
        if(num == 0){ return to_string(0);}
        while(num > 0)
        {
        str.push_back(  '0' + (num%7) );
        num = num/7; 
        }
        if(sign=='n') str.push_back('-');
        std::reverse(str.begin(), str.end());
        return str ;  
    }
};
```
['C++']