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
- -107 <= num <= 107
Starter code (python)
class Solution(object):
def convertToBase7(self, num):
"""
:type num: int
:rtype: str
"""
Related problems
- Add Two Numbers (Medium)
- Longest Substring Without Repeating Characters (Medium)
- Longest Palindromic Substring (Medium)
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.