Easy, Fast Python Solutions (2 Approaches - 24ms, 32ms; Faster than 95%)
Easy, Fast Python Solutions (2 Approaches - 24ms, 32ms; Faster than 95%)\n\n## Approach 1 - Using List\nRuntime: 24 ms, faster than 95% of Python3 online submis
# Easy, Fast Python Solutions (2 Approaches - 24ms, 32ms; Faster than 95%)\n\n## Approach 1 - Using List\n**Runtime: 24 ms, faster than 95% of Python3 online submissions for Base 7.**\n**Memory Usage: 14 MB, less than 90% of Python3 online submissions for Base 7.**\n```\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        answer = []\n        sign = num\n\n        if not num:\n            return "0"\n        elif num < 0:\n            num *= -1\n\n        while num:\n            a = str(num % 7)\n            answer.insert(0, a)\n            num = num // 7\n\n        if sign < 0:\n            return "-" + "".join(answer)\n        else:\n            return "".join(answer)\n```\n\n\n## Aproach 2 - Using String\n**Runtime: 32 ms, faster than 62% of Python3 online submissions for Base 7.**\n**Memory Usage: 14.2 MB, less than 70% of Python3 online submissions for Base 7.**\n\n```\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        answer = ""\n        sign = num\n\n        if not num:\n            return "0"\n        elif num < 0:\n            num *= -1\n\n        while num:\n            a = str(num % 7)\n            answer = a + answer\n            num = num // 7\n\n        if sign < 0:\n            answer = "-" + answer\n\n        return answer\n```
['String', 'Python', 'Python3']