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
Graphsmedium45 minAI/ML Engineer

Vector Dependency DAG Recovery

AI/ML Engineer signal: topological sort + cycle detection in a vector search retrieval context. This is a ProdMatch-owned ai ml engineer drill, framed as a April 2026 Pine Labs RAG Platform simulation, not a copied platform question.

Company context

Pine Labs · RAG Platform

Freshness

April 2026

Product surface

vector search retrieval

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

Question

You own vector search retrieval for a AI/ML Engineer loop. Given embeddings 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

  • vector search
  • RAG retrieval
  • recommendation graphs
  • topological sort
  • cycle detection
  • dependency graph

embeddings: 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

Vector Evidence Path FinderhardGraphRAG Dependency DAG RecoveryhardGraphRAG Evidence Path Findermedium