n Amazon retailers. Each retailer is located at a specific coordinate (xi, yi) and can deliver to any point inside or on the boundaries of a rectangle with corners at (0, 0) and (xi, yi).q requests, where each request asks how many retailers can deliver to the point (a, b).def countDeliveries(retailers, requests):
results = []
# Iterate over each request for a, b in requests:
count = 0 # For each retailer, check if they can deliver to the point (a, b) for x, y in retailers:
if 0 <= a <= x and 0 <= b <= y:
count += 1 results.append(count)
return results
OR
def countDeliveries(retailers, requests):
results = []
# For each request, check how many retailers can deliver for a, b in requests:
count = 0 for xi, yi in retailers:
# Check if the request (a, b) lies within the rectangle (0,0) to (xi, yi) if 0 <= a <= xi and 0 <= b <= yi:
count += 1 results.append(count)
return results