← Together AI Interview Insights

Together AI·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Technical phone screen for a software engineer role at Together AI. The whole thing was a graph problem, two parts, and it moved faster than I expected.

Questions Asked (2)

Q1

Given a directed graph representing software pod dependencies, detect whether the graph contains a cycle.

Algorithms & Data Structures
Author's notes

Classic topological sort or DFS with a visited-state tracker.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use DFS with a recursion stack to detect back edges, or Kahn's algorithm for topological sorting. Clearly state the time and space complexity, and discuss trade-offs between the two approaches.

Pro tip: Mention that Kahn's algorithm can also provide a topological order if no cycle exists, which is useful for dependency resolution. Also, clarify that the graph may not be connected, so you must check all nodes.

1. Clarify the problem

Confirm that the graph is directed, may have multiple components, and that we need to detect any cycle. Ask if self-loops or parallel edges are possible.

2. Choose an algorithm

Select either DFS with recursion stack or Kahn's algorithm. Explain why you chose it, considering factors like ease of implementation, need for topological order, or memory constraints.

3. Outline the algorithm

Describe the steps: For DFS, mark nodes as unvisited, visiting, or visited; if a visiting node is encountered, a cycle exists. For Kahn's, compute in-degrees, enqueue nodes with in-degree 0, and count processed nodes; if count < total nodes, a cycle exists.

4. Analyze complexity

State that both algorithms run in O(V+E) time and O(V) space. Mention that DFS uses recursion stack space, while Kahn's uses a queue.

5. Discuss edge cases and extensions

Cover disconnected graphs, self-loops, and large graphs. Mention that if a cycle is found, you might want to output the cycle nodes, which DFS can do easily.

Key Points to Mention

  • Directed graph cycle detection using DFS with recursion stack (colors: white, gray, black).
  • Kahn's algorithm (BFS-based topological sort) and its ability to detect cycles by counting processed nodes.
  • Time complexity O(V+E) and space complexity O(V) for both approaches.
  • Handling disconnected graphs by iterating over all vertices.
  • Trade-offs: DFS is simpler for cycle detection alone, while Kahn's provides topological order if acyclic.
  • Real-world application: detecting circular dependencies in software pods or build systems.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

If the dependency graph contains a cycle, identify a single edge that can be removed to make the graph acyclic.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I slowed down.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that any edge in a cycle can be removed to break it, but the choice depends on trade-offs like minimizing disruption or preserving important dependencies. Then propose a concrete algorithm: detect cycles using DFS or Kahn's algorithm, and during detection, identify a back edge in the DFS tree—removing that back edge guarantees acyclicity.

Pro tip: Mention that in real systems, you often want to remove the edge that is least critical or easiest to refactor, and that you can use topological sort to verify the result. This shows you think beyond the algorithm to practical impact.

1. Clarify the goal

Confirm whether the goal is to remove any edge that breaks all cycles, or to minimize disruption. This affects which edge you choose.

2. Detect cycles

Use DFS with a recursion stack or Kahn's algorithm to detect cycles. During DFS, classify edges as tree, forward, back, or cross.

3. Identify a removable edge

A back edge (an edge from a node to an ancestor in the DFS tree) always indicates a cycle. Removing any back edge breaks that cycle and makes the graph acyclic.

4. Verify acyclicity

After removal, run a topological sort or cycle detection again to ensure no cycles remain.

5. Discuss trade-offs

Explain that if multiple cycles exist, removing one back edge may not break all cycles; you might need to remove multiple edges. Also consider edge importance.

Key Points to Mention

  • Cycle detection using DFS (back edges) or Kahn's algorithm (topological sort).
  • A back edge in DFS is part of a cycle; removing it breaks that cycle.
  • Removing any edge from a cycle makes the graph acyclic, but if cycles overlap, one removal may not suffice.
  • Trade-offs: choose an edge that minimizes impact on system functionality or dependencies.
  • Verification: after removal, re-run cycle detection or topological sort.
  • Complexity: O(V+E) for detection and removal.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.