Zepruv › Coding problems

Base 7

Easy · Math, String

Given an integer num, return a string of its base 7 representation.

Example 1

Input: num = 100
Output: "202"

Example 2

Input: num = -7
Output: "-10"

Constraints

Starter code (python)

class Solution(object):
    def convertToBase7(self, num):
        """
        :type num: int
        :rtype: str
        """
        

Related problems

Previous: Next Greater Element II · Next: Perfect Number · All problems

Zepruv is a technical interview practice platform. Read any problem for free; sign in to run your code, submit and keep your progress.