Compute minimal time to finish dependent tasks | Uber Interview Question