Re: [闲聊] 每日leetcode

楼主: dont   2024-08-16 00:08:23
860. Lemonade Change
## 思路
就照题目模拟, 5元直接收下, 10元找5元, 20元找15元
## Code
```python
class Solution:
def lemonadeChange(self, bills: List[int]) -> bool:
coin = [0, 0]
for bill in bills:
if bill == 5:
coin[0] += 1
elif bill == 10:
if coin[0]:
coin[0] -= 1
else:
return False
coin[1] += 1
else:
if coin[1] and coin[0]:
coin[0] -= 1
coin[1] -= 1
elif coin[0] > 2:
coin[0] -= 3
else:
return False
return True
```
作者: CanIndulgeMe (CIM)   2024-08-16 00:09:00
技术大神
作者: oin1104 (是oin的说)   2024-08-16 00:19:00
我快哭了 你好强

Links booklink

Contact Us: admin [ a t ] ucptt.com