Skip to main content
Commonmark migration
Source Link

#Introduction

Introduction

#Challenge

Challenge

#Examples

Examples

#Introduction

#Challenge

#Examples

Introduction

Challenge

Examples

clarified rule on leading zeroes based on test case
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975
  • The number to be converted will be a non-negative integer (since - and . may be in the character set). So too will be the output.
  • Leading zeroes (the first character in the character set) should be trimmed. If the result is zero, a single zero digit should remain.
  • The minimum supported base range is from 2 to 95, consisting of the printable ascii characters.
  • The input for the number to be converted, the character set, and the output must all be of the string datatype. The bases must be of the base-10 integer datatype (or integer floats).
  • The length of the input number string can be very large. It's hard to quantify a sensible minimum, but expect it to be able to handle at least 1000 characters, and complete 100 characters input in less than 10 seconds on a decent machine (very generous for this sort of problem, but I don't want speed to be the focus).
  • You cannot use built in change-of-base functions.
  • The character set input can be in any arrangement, not just the typical 0-9a-z...etc.
  • Assume that only valid input will be used. Don't worry about error handling.
  • The number to be converted will be a non-negative integer (since - and . may be in the character set). So too will be the output.
  • Leading zeroes (the first character in the character set) should be trimmed.
  • The minimum supported base range is from 2 to 95, consisting of the printable ascii characters.
  • The input for the number to be converted, the character set, and the output must all be of the string datatype. The bases must be of the base-10 integer datatype (or integer floats).
  • The length of the input number string can be very large. It's hard to quantify a sensible minimum, but expect it to be able to handle at least 1000 characters, and complete 100 characters input in less than 10 seconds on a decent machine (very generous for this sort of problem, but I don't want speed to be the focus).
  • You cannot use built in change-of-base functions.
  • The character set input can be in any arrangement, not just the typical 0-9a-z...etc.
  • Assume that only valid input will be used. Don't worry about error handling.
  • The number to be converted will be a non-negative integer (since - and . may be in the character set). So too will be the output.
  • Leading zeroes (the first character in the character set) should be trimmed. If the result is zero, a single zero digit should remain.
  • The minimum supported base range is from 2 to 95, consisting of the printable ascii characters.
  • The input for the number to be converted, the character set, and the output must all be of the string datatype. The bases must be of the base-10 integer datatype (or integer floats).
  • The length of the input number string can be very large. It's hard to quantify a sensible minimum, but expect it to be able to handle at least 1000 characters, and complete 100 characters input in less than 10 seconds on a decent machine (very generous for this sort of problem, but I don't want speed to be the focus).
  • You cannot use built in change-of-base functions.
  • The character set input can be in any arrangement, not just the typical 0-9a-z...etc.
  • Assume that only valid input will be used. Don't worry about error handling.
deleted 2 characters in body
Source Link
Mwr247
  • 3.6k
  • 18
  • 39

Write a program or function in the language of your choice that can convert a string of one base to a string of another base. Input should be the number to be converted (string), from-base (base-10 integernumber), to-base (base-10 integernumber), and the character set (string). Output should be the converted number (string).

Write a program or function in the language of your choice that can convert a string of one base to a string of another base. Input should be the number to be converted (string), from-base (base-10 integer), to-base (base-10 integer), and the character set (string). Output should be the converted number (string).

Write a program or function in the language of your choice that can convert a string of one base to a string of another base. Input should be the number to be converted (string), from-base (base-10 number), to-base (base-10 number), and the character set (string). Output should be the converted number (string).

added 9 characters in body
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Fixed bad test case, and made rules clearer
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Tweeted twitter.com/StackCodeGolf/status/686692006358302723
Post Reopened by Mwr247, user45941, wizzwizz4, MegaTom, LegionMammal978
Further clarification and simplification
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Changed opening from implying this was a first of it's kind, to clarifying the difference
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Post Closed as "Duplicate" by Peter Taylor code-golf
Clarified rules
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Added a few more example cases
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Added a few more example cases
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading
Source Link
Mwr247
  • 3.6k
  • 18
  • 39
Loading