#22Bank Cheque Writer
HardDivide and ConquerRecursionMathStringSimulationImplementation
A bank needs to print the numerical amount on a cheque in words to prevent mistakes. Given a non-negative integer num, convert the complete amount into its English words representation. The words should follow standard English number formatting using: Thousand Million Billion
For example: 12345 → Twelve Thousand Three Hundred Forty Five There should be exactly one space between consecutive words, with no leading or trailing spaces.
Examples
Example 1
Input: num = 507
Output: "Five Hundred Seven"
Explanation: 500 → Five Hundred 7 → Seven
Example 2
Input: num = 42018
Output: "Forty Two Thousand Eighteen"
Explanation: --
Example 3
Input: num = 3056007
Output: "Three Million Fifty Six Thousand Seven"
Explanation: --
Constraints
- 0 ≤ num ≤ 999,999,999
- num is an integer.
- num will never be negative.
- The output should use English words with the first letter of each word capitalized.
- Do not include unnecessary spaces.
- 0 should be represented as "Zero".
