Integer to English Words

Hard · Math & Number Theory · about 30 minutes

Asked at Meta, Amazon, Microsoft, Google, LinkedIn, Apple.

Convert a non-negative integer num (up to 2³¹ − 1) to its English words representation, for example 12345 → "Twelve Thousand Three Hundred Forty Five". Capitalize every word, separate words with single spaces, and don't use "and". Zero is "Zero".