Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Real-Time Feed Update Propagation

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Real-Time Feed Update Propagation. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given a directed graph of mobile UI components, where u -> v means v depends on updates from u, return the order in which a change at source propagates through the graph. Visit each reachable component once, even if multiple paths lead to it.

Constraints

  • 1 <= n <= 10^5
  • 0 <= len(edges) <= 2 * 10^5
  • 0 <= u, v < n for every edge [u, v]
  • The graph may contain cycles
  • Each component should appear at most once in the output
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output