[Swift] Simplest solution
Please, upvote if you found the solution useful.\n\nclass Solution {\n\t/// Time: O(n). Space: O(n).\n    func convertToBase7(_ num: Int) -> String {\n        v
Please, upvote if you found the solution useful.\n```\nclass Solution {\n\t/// Time: O(n). Space: O(n).\n    func convertToBase7(_ num: Int) -> String {\n        var n = abs(num)\n        var i = 1\n        var result = 0\n\n        while n > 0 {\n            result += (n % 7) * i\n            i *= 10\n            n /= 7\n        }\n        return num.signum() == -1 ? "-\\(result)" : "\\(result)"\n    }\n}\n```
['Swift']