https://leetcode.com/problems/lemonade-change
860. Lemonade Change
柠檬水一杯 5 元 硬币有 5 / 10 / 20 三种
按照订单 高于价格的话要找零
如果能全部都顺利找零 则为 true 反之则回传 false
Example 1:
  Input: bills = [5,5,5,10,20]
  Output: true
  Explanation: 前3个都获得5元 第4个找5元 第5个找10+5元
Example 2:
  Input: bills = [5,5,10,10,20]
  Output: false
  Explanation: 前2个都获得5元 第3个与第4个都5元 第5个只有2个10元 没有15元能找
思路:
   照着做就好了
Python Code:
class Solution:
    def lemonadeChange(self, bills: List[int]) -> bool:
        changes = {5: 0, 10: 0, 20: 0}
        for bill in bills:
            if bill == 5:
                changes[5] += 1
                continue
            if not changes[5]:
                return False
            if bill == 10:
                changes[10] += 1
                changes[5] -= 1
            else:
                if not changes[10]:
                    if changes[5] < 3:
                        return False
                    changes[20] += 1
                    changes[5] -= 3
                else:
                    changes[20] += 1
                    changes[10] -= 1
                    changes[5] -= 1
        return True