Convert a non-negative integer to its English words representation. Return null for null input. The input will be between 0 and 2147483647 inclusive.
Use standard American English word composition:
- Zero renders as "Zero"
- Numbers 1 through 19 use their single word form
- Tens use: Twenty, Thirty, Forty, Fifty, Sixty, Seventy, Eighty, Ninety
- Use "Hundred" for hundreds
- Use "Thousand", "Million", and "Billion" for larger groups
- Separate all words with a single space
- Do not use the word "and"
Examples:
Input: num = 0
Output: 'Zero'
Explanation: Zero has its own word
Input: num = 123
Output: 'One Hundred Twenty Three'
Explanation: Hundreds, then tens, then units, no "and" between groups
Input: num = 12345
Output: 'Twelve Thousand Three Hundred Forty Five'
Explanation: Group by thousands from right to left
Input: num = 1234567
Output: 'One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven'
Explanation: Group by millions, thousands, then remainder
Input: num = null
Output: null
Explanation: Null input returns null
Apex Code Editor
Welcome to Lightning Challenge!
How It Works
- • Write your solution in the code editor
- • Connect your Salesforce org to test
- • Submit to check if your solution passes
- • Use hints if you get stuck
Contest Alert
🏆 #CodeEveryDay July 2026
Contest runs July 1 - 31. Complete challenges to climb the leaderboard!
Only the 31 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.