FunctionRacerProblemsRace

Number in Words

HardStringsPython, JavaScript, TypeScript, Java, C++

Return n written in English words: lowercase, one space between words, no "and" and no hyphens.

1234567 is "one million two hundred thirty four thousand five hundred sixty seven", and 0 is "zero".

Example 1

n 1234567
returns "one million two hundred thirty four thousand five hundred sixty seven"

Three groups: 1 (million), 234 (thousand) and 567.

Example 2

n 0
returns "zero"

Zero is the one number that needs its own word.

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 Strings problems