Snapchat Uber | Minimum time to complete all tasks

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-10-06Added By Anonymous
Source: Link

Company: Uber

Role: software engineer ii

Interview Stage: Onsite


Original Post Content:


I was asked the same question in Snapchat phone screen as well as Uber onsite. The question goes as follows.

There are some tasks/microservices n1, n2, n3, n4 etc. You will be given a dependency list for eg

[(n1, n2), (n2, n3)] signifying n1 depends on n2 and n2 depends on n3 and so on.

Every task/microservice needs time to execute. The time for task/microservice is t1, t2, t3, t3 for n1, n2, n3 and n4 respectively.


The task is to find the minimum time to complete all tasks.


I used topological sort to solve it but apparently it was not the best possible answer.

Comments