In a newly planned city, where a city is located at each integral coordinate in a 2-dimensional plane, there are n Amazon retailers. The retailer residing in the city at the coordinate (xi, yj) and can deliver to all the cities covered by the rectangle having the 4 corner points (0,0),(xi ,0),(0 yj). (xi, yj) We say that a point (a,b) is covered by a rectangle if it lies inside the rectangle or on its boundaries. Note that no 2 retailers reside in the same city.
Given q requests of the form (a,b), determine the number of retailers who can deliver to the city at the coordinate (a, b)
Example:
retailers = [[1, 2], [2, 3], [1, 5]]
requests=[[1,1],[1,4]]

In this example. We have 3 retailers in the cities (1, 2), (2, 3), and (1,5)
For the first request, all retailers can deliver to the city at the coordinate (1,1).
For the second request, only the third retailer can deliver to the city at the coordinate (1, 4).
Hence, the answer for this example will be [3,1].
Function Description:
Complete the function
countNumberOfRetailers in the editor below.
countNumberOfRetialers has the following parameter(s):
int retailers[n][2]: the retailers coordinates
int requests[q][2]: the coordinates of cities to deliver to
**Returns **
int array[q]: the ith element is the answer to ith query.
Constraints
1<=n, q<=7.5*10power4
1<=retailers[i][0] ≤ 10power9
1<=retailers[i][1]<=100
0<=requests[i][0] <=10power9
O<=requests[i][1] ≤ 100
No two retailers share the same coordinates.
Function Definition:
public List<Integer> countNumberOfRetialers(List<List<Integer>> retailers, List<List<Integer>> requests)
With Brute force approach 8 out of 15 test cases were passed.
Any solution with optimized approach is much appreciated.