gary@interview:~/interview/coding/504-base-7.md$
$ cat ./coding/504-base-7.md
[Coding]

504. Base 7

────────────────────────────────────────────────────────────

504. Base 7

class Solution:
    def convertToBase7(self, num: int) -> str:
        
        if num == 0:
            return "0"
        
        neg = num < 0
        num = num * -1 if neg else num
        res = ""
        
        while num // 7 != 0 or num % 7 != 0:
            res = res + str((num % 7))
            num = num // 7
        
        if neg:
            res = res + "-"
        
        res = res[::-1]
        
        return str(res)
--tags#Bit Manipulation
$ ls ./coding/ | grep -v 504-base-7
265. Paint House II256. Paint House143. Reorder List1762. Buildings With an Ocean View
← cd ../codingcd ~