Microsoft Phone
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-02-01Added By Anonymous
Source: Link
Microsoft Phone interview:
1Given the positions of houses and routers on a horizontal line, return the minimum radius of the routers such that all houses have wifi.
2All routers have the same radius.
3
4Example 1:
5Input: houses=[1,2,3], routers=[2]
6Outpu: 1
7
8Example 2:
9Input: houses=[1,2,3,4], routers=[1,4]
10Output: 1
11
12Example3:
13Input: houses=[1,5], routers=[2]
14Output: 3