Given a non-negative integer n and a base base (between 2 and 16 inclusive), convert n to its string representation in the given base.
For bases greater than 10, use lowercase letters a-f to represent digit values 10-15. For example:
convertBase(255, 16) returns "ff"convertBase(10, 2) returns "1010"convertBase(0, 8) returns "0"n = 255, base = 16"ff"n = 10, base = 2"1010"n = 0, base = 8"0"0 <= n <= 10^92 <= base <= 16Run your code to see results
Use Cmd+Enter to run