感觉应该算是简单题
思路:
class Solution:
def filterRestaurants(self, restaurants: List[List[int]], veganFriendly: int, maxPrice: int, maxDistance: int) -> List[int]:
ans = []
for rest in restaurants:
if veganFriendly == 1 and rest[2] != 1:
continue
if rest[3] > maxPrice or rest[4] > maxDistance:
continue
ans.append(rest)
ans.sort(key=lambda c:(c[1], c[0]), reverse=True)
return [i[0] for i in ans]