Integer to English Words - aloalgo

Integer to English Words

Medium

Convert a non-negative integer to its English words representation. The input integer is guaranteed to be less than 2^31 - 1.

Example 1

Input
123
Output
"One Hundred Twenty Three"
Explanation:

123 is broken down as 'One Hundred' and 'Twenty Three'.

Example 2

Input
12345
Output
"Twelve Thousand Three Hundred Forty Five"
Explanation:

12345 is broken down into 12 Thousand and 345. 12 is 'Twelve', 345 is 'Three Hundred Forty Five'.

Example 3

Input
1234567
Output
"One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"
Explanation:

1234567 is broken down into 1 Million, 234 Thousand, and 567. Each part is converted separately and then combined with magnitude words.

Loading...
Input
123
Output
"One Hundred Twenty Three"

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!