Test Cases
Case 1
Case 2
Input
[[["grocery", "school"], ["school", "gym"], ["grocery"], ["gym", "school"]], ["grocery", "school", "gym"]]
Output
2
You're moving to a new city and looking for an apartment to live in. There are several amenities you need access to from your new place: a grocery store, a school, and a gym, among others. Given a list of amenities and a map of the city where each block is marked with the amenities available on that block, write a function to find the block that minimizes the farthest distance to all your required amenities.
Example 1
Input: [[["grocery", "school"], ["school", "gym"], ["grocery"], ["gym", "school"]], ["grocery", "school", "gym"]]
Output: 2
Example 2
Input: [[["gym"], ["school", "gym"], ["grocery", "school"]], ["grocery", "school", "gym"]]
Output: 1
1 <= blocks.length <= 10^4
Input
Output