Easy Solution || Python || Maths || Beats 100%
My Solution Beats 100% in runtime\n# Intuition\n Describe your first thoughts on how to solve this problem. \nThe main motive of this problem is to find the bas
# My Solution Beats 100% in runtime\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe main motive of this problem is to find the base 7 value of given input integer number and return as string.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nUsing Loops and conditional statements..\nFind whether the given number or interger is 0 or positive or negative.Generate the base 7 value accordingly.\n\n# Complexity\n- Time complexity:O(log n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(log n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def convertToBase7(self, num: int) -> str:\n        s=""\n        if num>0:\n            while num!=0:\n                n=num//7\n                a=num%7\n                s+=str(a)\n                num=n\n            return s[::-1]\n        elif num==0:\n            return \'0\'\n        else:\n            num=num*-1\n            while num!=0:\n                n=num//7\n                a=num%7\n                s+=str(a)\n                num=n\n            \n            return \'-\'+s[::-1]\n\n```\n# Please UPVOTE me..!
['Math', 'Python3']