← SoFi Interview Insights

SoFi·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

SoFi software engineer interview with a graph traversal problem that sounds like a fun puzzle until you realize they want you to talk through complexity and cycle handling on top of writing the actual solution.

Questions Asked (1)

Q1

You're given a choose-your-own-adventure story modeled as a graph. Each node has options pointing to other nodes or ending nodes. Unlike a normal adventure where you pick one path, here you must traverse ALL options from every node. Find every reachable ending from the start node, handle cycles, and analyze the time and space complexity.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The story framing threw me off for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the story as a directed graph and perform a full traversal (DFS or BFS) from the start node, tracking visited nodes to avoid infinite loops. Collect all ending nodes encountered during the traversal, then analyze the time and space complexity based on the number of nodes and edges.

Pro tip: Explicitly discuss how you handle cycles (e.g., using a visited set) and mention that the traversal must explore all branches, not just one path. Also, clarify whether the graph is a DAG or may contain cycles, as this affects the approach and complexity.

1. Clarify the problem and graph representation

Confirm that each node's options are directed edges, and that you must traverse all reachable nodes. Ask about input format (adjacency list, etc.) and whether cycles are possible.

2. Choose traversal algorithm and handle cycles

Select DFS (recursive or iterative) or BFS. Use a visited set to avoid revisiting nodes and infinite loops. Ensure all branches are explored.

3. Collect ending nodes

During traversal, whenever you encounter a node with no outgoing edges (an ending node), add it to a result set. Return the set of all reachable endings.

4. Analyze time and space complexity

Time: O(V + E) where V is number of nodes and E is number of edges, since each node and edge is visited once. Space: O(V) for the visited set and recursion stack (DFS) or queue (BFS), plus O(V) for the result set.

5. Discuss edge cases and trade-offs

Consider empty graph, start node is an ending, disconnected components, and very large graphs. Compare DFS vs BFS in terms of memory and suitability.

Key Points to Mention

  • Graph traversal using DFS or BFS
  • Cycle detection with a visited set
  • Time complexity O(V + E)
  • Space complexity O(V)
  • Handling all branches (not just one path)
  • Edge cases: empty graph, start node is ending, disconnected nodes

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