Medium · Math
Integer to English Words
Given a non-negative integer num (at most 2³¹ − 1), return its English words representation with capitalized words separated by single spaces, for example 1234567 → "One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven" and 0 → "Zero".
Examples
Example 1
{
"num": 1234567
}Output: One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven
Example 2
{
"num": 1000010
}Output: One Million Ten
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.