Reported September 2026
Straladepth first search

Evaluate Live Spreadsheet Expressions

Reported by candidates from Strala's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Strala OA. Under 2s to a working solution.
Founder's read

Strala's September 2026 OA hands you a spreadsheet with live references and asks you to evaluate GETs after arbitrary overwrites. It looks like a design problem. It really reduces to a memoized DFS over a dependency graph, with a cache you have to throw away at the right moment. If you blank on the invalidation part, StealthCoder runs invisibly on your screen during the live OA and can hand you the working structure. Read the trick below first. It's short.

The problem

Implement a spreadsheet whose cells are named by uppercase letters followed by a positive row number, such as A1 or BC12. Process an ordered array of operations.
SET cell expression overwrites the cell. An expression is one or more terms joined by +. Each term is either an integer literal, which may be negative, or another cell name.
GET cell evaluates the cell using the spreadsheet's current contents and appends its value to the result.
References are live: after a referenced cell is overwritten, later reads use the new value through every dependency level. Every cell reached by a GET has been assigned, and the current dependency graph is acyclic.
Return the signed 64-bit results of all GET operations in order.

Function
runSpreadsheet(operations: String[]) → long[]

Examples
Example 1
operations = ["SET A1 5","SET B1 A1+3","GET B1","SET A1 10","GET B1"]
return = [8,13]
B1 keeps a live reference to A1, so the second read observes the overwrite.
Example 2
operations = ["SET X1 -4","SET Y1 X1+10+X1","GET Y1","SET X1 3","GET Y1"]
return = [2,16]
Repeated cell references count separately, and negative literals are supported.

Constraints
1 <= operations.length <= 100000.
Each cell name matches [A-Z]+[1-9][0-9]*.
Every expression contains at least one term. Terms contain no whitespace and are separated by one +.
The total number of expression terms across all SET operations is at most 100000.
Across all GET operations, the sum of stored terms in the distinct cells reachable by each query is at most 200000.
Every cell reached by a GET has been assigned, and every represented dependency graph is acyclic.
Every literal, intermediate sum, and result fits in a signed 64-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Store each cell as a list of terms: literals and cell names. On GET, run a DFS from that cell, summing literals and recursing on references. Repeated references count separately, so X1+X1 means you evaluate X1 twice, or evaluate once and multiply by the count. The constraint says the sum of stored terms in distinct reachable cells per query is at most 200000, so a memoized DFS per GET, with a fresh visited map each query, fits. Memoize within a single GET so shared cells aren't recomputed. The pitfall is caching values across SETs. An overwrite changes every dependent upstream, so a persistent cache goes stale unless you clear it on each SET. Simplest safe approach is a per-GET memo only. Use long, not int, and parse negative literals carefully. Split on + only, since the minus sign belongs to the literal. If you freeze live, StealthCoder is the hedge.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Evaluate Live Spreadsheet Expressions cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder
⏵ The honest play

You've seen the question. Make sure you actually pass Strala's OA.

Strala reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Evaluate Live Spreadsheet Expressions FAQ

What's the trick in the Strala spreadsheet OA?+

Treat cells as nodes in a DAG. Each cell stores its terms. A GET does a DFS with a memo map that lives only for that query. Literals add directly, cell names recurse. No cycle detection is needed because the problem guarantees acyclic.

Why not cache values between operations?+

A SET on one cell changes every cell that depends on it, directly or through several levels. Tracking that invalidation is extra work and easy to get wrong. A per-GET memo is enough under the stated term-sum limits.

How do I parse expressions with negative numbers?+

Split on the plus sign only. Terms have no whitespace, so -4 stays one token. If a token starts with a letter, it's a cell name. Otherwise parse it as a long. Don't split on minus.

Do repeated references count more than once?+

Yes. Y1 = X1+10+X1 with X1 = -4 gives 2. With the per-GET memo, the second lookup of X1 is a map hit, so you add its value twice without recomputing.

How do I prepare for this in 48 hours?+

Write the solution once from scratch: a hash map of cell to term list, a recursive evaluate with a memo, and long arithmetic. Test both examples. Then think about deep chains and recursion depth, and consider an iterative DFS if your language's stack is limited.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Strala.

OA at Strala?
Invisible during screen share
Get it