Uber DSA round

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-01-17Added By Anonymous
Source: Link

Company: Uber

Role: software engineer i / software engineer ii

Interview Stage: Phone Screen


Original Post Content:

1-> n cities are given and a threshold is given and there is a bi-directional road between x and y if

x%z==0

y%z==0

z>threshold


Make connections and later they will provide different source and target cities, tell whether a road is there or not (road can be indirect as well).

The solution I gave was run a loop of threshold+1 till n+1, and then make connections with multiplier

Comments