Description
Convert a non-negative integer num to its English words representation. Handle values up to 2^31 - 1 with Thousand, Million, Billion.
Examples
Input:
num = 1234567Output:
"One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"Explanation:
Convert to words.
Input:
num = 0Output:
ZeroExplanation:
The edge case where the input is zero should return 'Zero' as the English word representation.
Input:
num = 50301Output:
Fifty Thousand Three Hundred OneExplanation:
This example demonstrates handling numbers with zeros in the middle. The zero in the tens place of 50301 is skipped, avoiding phrases like 'Three Hundred Zero One'. The correct output is 'Fifty Thousand Three Hundred One'.
Constraints
- •
0 ≤ num ≤ 2³¹ - 1