ProdMatch
CompaniesCitiesRolesSign in

Companies

  • Google
  • Microsoft
  • Meta
  • Amazon
  • Apple
  • Atlassian
  • Nvidia
  • Oracle
  • See all 51 →

Cities

  • Bengaluru jobs
  • Hyderabad jobs
  • Pune jobs
  • Gurugram jobs
  • Noida jobs
  • Delhi NCR jobs
  • Mumbai jobs
  • Chennai jobs
  • Remote-India jobs

Roles

  • QA / SDET Engineers
  • Backend Engineers
  • Frontend Engineers
  • Full-stack Engineers
  • Data Analysts
  • Data Engineers
  • ML / AI Engineers
  • DevOps / SRE Engineers
  • All roles →

ProdMatch

  • About
  • Career guides
  • Compare
  • Salaries
  • Skills
  • DSA practice
  • Privacy
  • Terms
  • Sign in

© 2026 ProdMatch.ai · Built for India · DPDP Act 2023 compliant · Job data sourced from official company career pages.

Back to DSA
Graphshard70 minFrontend Engineer

Autocomplete Dependency DAG Recovery

Frontend Engineer signal: topological sort + cycle detection in a search autocomplete context. This is a ProdMatch-owned frontend engineer drill, framed as a May 2026 BrowserStack Search UX simulation, not a copied platform question.

Company context

BrowserStack · Search UX

Freshness

May 2026

Product surface

search autocomplete

ProdMatch interview simulation based on product-team patterns; not a claim of a real company question.

Question

You own search autocomplete for a Frontend Engineer loop. Given queries and directed dependencies between them, return a valid execution order. If a cycle exists, return an empty list and identify that the rollout is blocked.

Input

  • n nodes labelled 0..n-1 and dependency pairs [before, after].

Output

  • A valid order of all nodes, or [] when dependencies contain a cycle.

Constraints

  • 1 <= n <= 200000
  • 0 <= dependencies.length <= 400000
  • The graph may be disconnected.

Concepts

  • render scheduling
  • state graphs
  • virtualization
  • topological sort
  • cycle detection
  • dependency graph

queries: 4, deps: [[0,1],[0,2],[2,3]] -> [0,1,2,3] or [0,2,1,3]

Approach

Try framing your own approach first. The 30 seconds you think before peeking is where learning happens.

Clean Solution

Reveal the approach first.

How well did you understand?

Your rating tunes when this problem shows up again.

Common Mistakes

  • Mark visited when enqueueing, not after repeated dequeue.
  • Do not ignore disconnected components if the product surface can have them.

Next Similar Problems

Timeline Dependency DAG RecoverymediumTimeline Evidence Path FinderhardAutocomplete Evidence Path Findermedium