FunctionRacerProblemsRace

Add Two Numbers in Base K

EasyMathPython, JavaScript, TypeScript, Java, C++

The strings a and b are non-negative numbers written in base k (digits 0 to 9, each smaller than k). Return their sum, also written in base k with no leading zeros (zero is "0").

Example 1

a "27"
b "16"
k 8
returns "45"

23 + 14 = 37, which is 45 in base 8.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems