Skip to main content
LeetCode 504, Easy. Topics: Math, String. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 25 parametrized pytest cases, and a playground notebook:

Problem

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

Examples

Constraints

  • -10^7 <= num <= 10^7

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

Last modified on September 7, 2026