python
class Solution:
def lemonadeChange(self, bills: List[int]) -> bool:
cash = [0] * 11
for i in range(len(bills)):
if bills[i] == 5:
cash[5] += 1
elif bills[i] == 10:
cash[5] -= 1
if cash[5] < 0:
return False
cash[10] += 1
else:
if cash[10] > 0 and cash[5] > 0:
cash[10] -= 1
cash[5] -= 1
elif cash[5] >= 3:
cash[5] -= 3
else:
return False
return True
python
class Solution:
def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]:
people.sort(key = lambda x: (-x[0], x[1]))
que = []
for p in people:
que.insert(p[1], p)
return que
python
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
points.sort(key = lambda x : x[1])
count = 0
ed = float('-inf')
for p in points:
if ed < p[0]:
count += 1
ed = p[1]
return count