Spelling an integer in words turns a number like 1234567 into the phrase you would say out loud — One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven. You implement integerToEnglishWords(n), which takes a non-negative integer and returns its English name as capitalized words separated by single spaces. This is the LeetCode 273 problem, and the naming follows standard English numerals.
The catch is place value. English does not name digits one at a time — it groups them in threes (thousands, millions, billions), names each group of three, and glues on a scale word. Along the way it has special one-word names for the teens (Thirteen, not Ten Three) and joins tens and ones without a hyphen (Twenty One).
integerToEnglishWords(n: number): string
// n is an integer, 0 <= n <= 2_147_483_647
integerToEnglishWords(0); // 'Zero'
integerToEnglishWords(21); // 'Twenty One'
integerToEnglishWords(105); // 'One Hundred Five'
integerToEnglishWords(1000); // 'One Thousand'
integerToEnglishWords(1234567);
// 'One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven'
integerToEnglishWords(1000005);
// 'One Million Five' (the empty thousands group adds nothing)
n is a non-negative integer up to 2147483647. That reaches the billions, so the scale words you need are Thousand, Million, and Billion.integerToEnglishWords(0) returns 'Zero'. Zero is the only input where the word Zero appears; it never shows up inside a larger number.Twenty One, not Twenty-One; write One Hundred Five, not One Hundred and Five. Every word is capitalized and separated by exactly one space.1000005 is One Million Five, with no gap where the thousands would go).13 is Thirteen, not Ten Three; the numbers 11 through 19 each have their own name.n is always a valid non-negative integer. You do not need to handle negative numbers, decimals, or strings.Unlock the solution & editor
Runnable editor + tests
Solve in the browser with instant Jest feedback.
Detailed solutions
Walkthroughs, edge cases, and complexity notes.
Multi-framework variants
React, Vue, Vanilla, Angular — same question, different stacks.