273. Integer to English Words

Description

Here

Pitfall

没啥难度,就是贼恶心。 感觉最佳intuitive的solution是用一个stack倒着存一遍,然后再用StringBuilder来组成final String

  1. thousandIndex 无论发生什么都得++
  2. 优先处理num = 0的各种情况
    1. num = 0 需要为 Zero
    2. lastTwo = 0需要为 ""
  3. String getThousand(int curThree) returns "" when no actual value; otherwise, the actual value.
    1. during the implementation, try to handle the 0 first.
    2. Inserting a prefixed space when there is a value

Solution

Optimal Solution

Intuitive Solution

results matching ""

    No results matching ""