Integer to English Words - Problem
Convert a non-negative integer num to its English words representation.
Example: Given num = 123, return "One Hundred Twenty Three"
Note: You need to handle numbers from 0 to 2,147,483,647 (2³¹ - 1)
The output should be properly capitalized with spaces between words, and no extra spaces at the beginning or end.
Input & Output
Example 1 — Basic Case
$
Input:
num = 123
›
Output:
One Hundred Twenty Three
💡 Note:
123 = 1 hundred + 20 + 3 → One Hundred Twenty Three
Example 2 — Edge Case Zero
$
Input:
num = 0
›
Output:
Zero
💡 Note:
Special case: zero is handled separately
Example 3 — Large Number
$
Input:
num = 1234567
›
Output:
One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven
💡 Note:
Break into groups: 1 million + 234 thousand + 567
Constraints
- 0 ≤ num ≤ 2³¹ - 1
- The input is guaranteed to be a valid integer
Visualization
Tap to expand
Understanding the Visualization
1
Input
Integer number like 123
2
Process
Convert each digit group to words
3
Output
English words: One Hundred Twenty Three
Key Takeaway
🎯 Key Insight: Group numbers by thousands and recursively convert each group using lookup arrays
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code