Lint a Conversation Flow Graph for Unreachable and Trapped Nodes

Last updated: November 29, 2026

Quick Overview

Given a voice agent's conversation flow as typed nodes and directed transitions with a start node, return nodes unreachable from the start and reachable nodes from which no end or transfer node can ever be reached.

Retell AI
Coding & Algorithms
Frontend Engineer
Retell AI
November 29, 2026
Frontend Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given a voice agent's conversation flow as typed nodes and directed transitions with a start node, return nodes unreachable from the start and reachable nodes from which no end or transfer node can ever be reached.

Retell's flow builder lets customers wire conversation, function, end and transfer nodes visually, and a publish-time linter saves them from agents that loop forever on a live call. The interviewer wants graph traversal from both directions and a clear definition of what 'stuck' means.

What the Interviewer Expects
  • Model the flow as forward and reverse adjacency lists
  • Forward BFS from start for reachability
  • Reverse BFS from all terminal nodes for 'can finish'
  • Report trapped nodes only among reachable ones
  • Linear time in nodes plus edges
Key Topics to Cover
graph traversal
BFS
reverse graph
static analysis
flow builder
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you also flag a node with no outgoing transition that is not terminal, with a clearer message?
  • Transitions have LLM-evaluated conditions; how do you warn about a node whose conditions can all be false?
  • How would you run this incrementally as the user edits the canvas?
  • How would you show the offending cycle to the user?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Nodes: {id: type}. Terminal types are end and transfer. Unreachable = not reachable from start. Trapped = reachable but no path to any terminal (a self-loop or a node with no exits). Return bo...

High-Level Design

Two BFS passes. Forward from start marks what a caller can ever hit. Reverse from every terminal, multi-source, marks nodes that can still finish. The set difference gives the trapped nodes. Doing rev...


Submit Your Answer
Markdown supported

Related Questions