5 kyu

[Code Golf] Yet Another Base Conversion

65 of 70anter69

Description:

Task

Convert the given number (provided as a string) from one number base to the other. The given number will always be non-negative, and valid in the given base. Return the result also as a string.

  • input number is < 1025
  • bases range from 2 to 62
  • the digits used are: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Examples

[number]    [from]   [to]       [result]
----------------------------------------
"0"          any     any   -->   "0"
"255"         10      16   -->   "ff"
"101010"       2      10   -->   "42"
"c0de"        16       2   -->   "1100000011011110"
"CodeWars"    62      26   -->   "onah0naham"

Your code can be maximum 170 bytes long.


My other katas

If you enjoyed this kata then please try my other katas! :-)

Translations are welcome!

Algorithms

Similar Kata:

Stats:

CreatedMar 22, 2019
PublishedMar 22, 2019
Warriors Trained253
Total Skips24
Total Code Submissions501
Total Times Completed70
Python Completions65
Ruby Completions11
Total Stars9
% of votes with a positive feedback rating86% of 40
Total "Very Satisfied" Votes33
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes4
Total Rank Assessments35
Average Assessed Rank
6 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • anter69 Avatar
  • dfhwze Avatar
Ad