← Bloomberg Interview Insights

Bloomberg·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Bloomberg SWE interview with a graph traversal problem set in a subway station context. Pretty standard BFS/DFS territory but they also wanted test cases on the spot, which tripped me up a bit.

Questions Asked (2)

Q1

Given a subway network represented as an adjacency map of station names, write a function that determines whether a path exists between two given stations. Stations not present in the map should be treated as having no connections.

Algorithms & Data Structures
Author's notes

I went with BFS, kept a visited set to handle cycles, and iterated through neighbors.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem and edge cases, then propose a graph traversal (BFS or DFS) to determine connectivity. Implement the solution with careful handling of missing stations and discuss complexity.

Pro tip: Mention that BFS is often preferred for path existence because it finds the shortest path and can terminate early, but DFS is simpler and uses less memory. Also, highlight the importance of treating missing stations as isolated nodes.

1. Clarify requirements and edge cases

Ask if the graph is directed or undirected, and confirm that missing stations should be treated as having no connections. Discuss edge cases like same start and end, or either station missing.

2. Choose traversal algorithm

Select BFS or DFS based on trade-offs. BFS is good for shortest path and early exit; DFS is simpler and uses less memory.

3. Implement traversal with visited set

Write a function that uses a queue (BFS) or stack (DFS) and a visited set to avoid cycles. Check if start or end is missing and return false if so.

4. Analyze complexity and test

State time and space complexity (O(V+E) time, O(V) space). Walk through test cases including disconnected graphs and missing stations.

Key Points to Mention

  • Graph representation: adjacency map (dictionary of lists)
  • BFS vs DFS trade-offs: BFS finds shortest path, DFS uses less memory
  • Handling missing stations: treat as having no connections, return false if start or end missing
  • Visited set to avoid infinite loops in cyclic graphs
  • Time and space complexity: O(V+E) time, O(V) space
  • Edge cases: start == end, empty graph, disconnected components

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

Q2

Write test cases for your path-finding function covering cycles, disconnected components, the case where start equals end, and missing stations.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I lost some points I think.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the function's contract and graph representation, then systematically design test cases for each specified scenario, including edge cases and expected outcomes. Prioritize tests that validate correctness and robustness, and discuss how to handle ambiguous cases like missing stations.

Pro tip: Demonstrate maturity by discussing not just test cases but also how you'd structure them (e.g., using a table-driven approach) and what each test reveals about the algorithm's assumptions. Mention that missing stations should be treated as an error condition unless specified otherwise, and test both start and end missing.

1. Clarify requirements and assumptions

Ask about the graph representation (adjacency list/matrix), whether the graph is directed/weighted, and the expected behavior for missing stations (error vs. empty path).

2. Design tests for each specified scenario

For cycles, ensure the algorithm doesn't loop infinitely and returns a valid path; for disconnected components, expect no path; for start equals end, expect a trivial path; for missing stations, expect an error or empty result.

3. Include edge cases and boundary conditions

Test empty graph, single node, start or end missing, and large graphs to check performance. Also test graphs with multiple paths to ensure shortest path is returned if applicable.

4. Define expected outcomes and assertions

For each test, specify the exact expected result (e.g., path list, distance, or exception) and how to assert it, ensuring tests are deterministic.

5. Discuss test organization and tooling

Explain how you'd structure tests (e.g., parameterized tests) and any mocking needed, and mention tools like JUnit or pytest to show practical experience.

Key Points to Mention

  • Graph representation and whether it's directed/weighted
  • Cycle handling: ensure termination and correct path
  • Disconnected components: expect no path or appropriate error
  • Start equals end: trivial path of length 0
  • Missing stations: error handling or empty result
  • Test organization: parameterized tests, edge cases, and performance considerations

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