Last active
May 5, 2022 19:25
-
-
Save Turskyi/867cd5f7ffee785a46dfa0660b29c4ff to your computer and use it in GitHub Desktop.
Given an integer, num, return its base seven representation as a string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun convertToBase7(num: Int): String { | |
return num.toString(radix = 7) | |
} | |
/* | |
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" | |
Ex: Given the following num... | |
num = 42, return “60”. | |
* */ | |
/* | |
In a positional numeral system, the radix or base is the number of unique digits, | |
including the digit zero, used to represent numbers. For example, | |
for the decimal/denary system (the most common system in use today) the radix (base number) is ten, | |
because it uses the ten digits from 0 through 9. | |
Radix is a Latin word for "root". Root can be considered a synonym for base, in the arithmetical sense. | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment