← Fuse Energy Interview Insights

Fuse Energy·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026Remote

Summary

Fuse Energy had me build a mini spreadsheet engine from scratch, SET/GET/SUM operations, dependency tracking, cycle detection and all. Pretty meaty for a single coding round and the cycle handling piece is where I think most people would trip up.

Questions Asked (2)

Q1

Design and implement an in-memory spreadsheet supporting SET, GET, and SUM operations, where SUM can reference individual cells or rectangular ranges, and values update dynamically when dependencies change.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

This is a bigger problem than it looks at first glance.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a design using a dependency graph to track cell relationships. Explain how SET, GET, and SUM operations work, including dynamic updates via topological ordering or lazy evaluation. Finally, discuss trade-offs and potential optimizations.

Pro tip: Mention that you would use a directed acyclic graph (DAG) to detect and prevent circular dependencies, and consider lazy evaluation to avoid unnecessary recomputations. This shows awareness of real-world edge cases and performance.

1. Clarify Requirements

Ask about expected operations, data types, range sizes, update frequency, and whether circular dependencies should be prevented. Confirm if SUM can reference other SUM cells.

2. Design Data Structures

Propose storing cell values in a hash map and maintaining a dependency graph where each cell tracks its dependents and dependencies. For ranges, consider storing them as objects that reference the range boundaries.

3. Implement Operations

For SET, update the cell value and propagate changes to dependents. For GET, return the stored value. For SUM, compute the sum of referenced cells or ranges, and register dependencies.

4. Handle Dynamic Updates

Use topological sorting or lazy evaluation to recompute dependent cells when a value changes. Detect cycles to prevent infinite loops.

5. Discuss Trade-offs and Optimizations

Compare eager vs. lazy evaluation, discuss time/space complexity, and suggest optimizations like caching or incremental updates for large ranges.

Key Points to Mention

  • Dependency graph with directed edges from dependencies to dependents
  • Cycle detection to prevent circular references
  • Topological ordering for efficient recomputation
  • Lazy evaluation to defer computations until needed
  • Handling rectangular ranges efficiently (e.g., using 2D prefix sums or iterating over cells)
  • Time and space complexity analysis for each operation

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

Q2

How do you detect and handle cyclic dependencies in the spreadsheet formula graph, for example if A1 depends on B1 and then B1 is set to depend on A1?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I blanked for a second on what 'reasonable behavior' even means here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the dependency graph and the cycle detection problem, then explain how you would detect cycles (e.g., DFS with recursion stack) and handle them (e.g., reject the edit, show an error, or break the cycle). Emphasize trade-offs between eager detection on each edit versus lazy detection during evaluation, and discuss incremental algorithms for performance.

Pro tip: Mention that cycle detection should be integrated into the edit operation to prevent invalid states, and that you can use topological sorting to both detect cycles and determine evaluation order. Also, consider that in a spreadsheet, cycles might be allowed temporarily but flagged, and that user experience matters (e.g., highlighting the cycle).

1. Define the graph model

Represent cells as nodes and dependencies as directed edges (e.g., A1 -> B1 if A1 depends on B1). Clarify that a cycle occurs when there is a directed cycle in this graph.

2. Choose a detection algorithm

Use DFS with a recursion stack (or colors: white/gray/black) to detect cycles in O(V+E) time. Alternatively, use Kahn's algorithm for topological sorting, which also detects cycles.

3. Decide when to detect

Compare eager detection (on each edit) versus lazy detection (during evaluation). Eager detection prevents invalid states but may be slower; lazy detection is simpler but can lead to errors later.

4. Handle the cycle

Options: reject the edit with an error message, allow the cycle but mark affected cells as errors, or break the cycle by removing a dependency. Discuss trade-offs and user experience.

5. Optimize for performance

For large spreadsheets, use incremental cycle detection (e.g., only check affected subgraph) or maintain a topological order and update it efficiently. Mention that full re-computation may be acceptable for small graphs.

Key Points to Mention

  • Directed graph representation of dependencies
  • DFS with recursion stack for cycle detection
  • Topological sorting (Kahn's algorithm) as alternative
  • Trade-offs between eager and lazy detection
  • Handling strategies: reject, mark as error, or break cycle
  • Incremental algorithms for performance in large spreadsheets

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