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!

Create an Account

Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.

Create account

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 June 2026

Contest runs June 1 - 30. Complete challenges to climb the leaderboard!

Only the 30 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In