LeetCode in Kotlin

504. Base 7

Easy

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:

Solution

class Solution {
    fun convertToBase7(num: Int): String {
        return Integer.toString(num, 7)
    }
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy