In-Memory Spreadsheet Values
Reported by candidates from Rippling's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Rippling OA reported in April 2025 looks like a toy spreadsheet, and that's the trap. It's a hash map with a string parser, and the points are lost on one thing: the expression =-9+23 has a negative first operand, so splitting on the wrong plus or minus sign breaks it. If you're taking this in the next day or two, read the parsing rules first. StealthCoder is the safety net running invisibly during the live OA if you blank, but this one is very doable on your own.
The problem
Implement the core of an in-memory spreadsheet. Each cell stores either an integer literal, a two-integer addition expression, or its default blank value. Process each operation in order: ["SET", cell, value]: store value in cell. A non-empty value is either a signed integer literal such as -9 or an expression such as =100+2. Setting value to the empty string resets the cell to its default blank value. ["GET_RAW", cell]: append the cell's stored text to the result. Append the empty string when the cell is blank. ["GET_COMPUTED", cell]: append the cell's displayed value to the result. An integer displays its decimal value, and an expression displays the decimal sum of its two integer operands. Append the empty string when the cell is blank. Only GET_RAW and GET_COMPUTED operations produce output. Return their results in operation order. Expressions contain integer literals only. They do not reference other cells. Function runSpreadsheet(operations: String[][]) → String[] Examples Example 1 operations = [["SET","A1","23"],["SET","B2","=2+8"],["GET_RAW","A1"],["GET_COMPUTED","B2"],["GET_RAW","B2"]] return = ["23","10","=2+8"] A1 stores the integer text "23". The computed view of B2 evaluates 2 + 8, while its raw view preserves "=2+8". Example 2 operations = [["SET","A1","-9"],["GET_COMPUTED","A1"],["SET","A1",""],["GET_RAW","A1"],["GET_COMPUTED","A1"]] return = ["-9","",""] Setting an empty value resets A1. Both views then return the default blank value. Example 3 operations = [["SET","C3","=100+2"],["SET","D4","=-9+23"],["GET_COMPUTED","C3"],["GET_COMPUTED","D4"],["SET","C3","7"],["GET_RAW","C3"],["GET_COMPUTED","C3"]] return = ["102","14","7","7"] Both expression cells are evaluated from their two literal operands. Overwriting C3 with "7" changes both its raw and computed views. Constraints 1 <= operations.length <= 10^5. Each cell identifier is a non-empty string of at most 20 uppercase letters and digits. Each operation has one of the documented forms. Every non-empty value is either a signed integer from -999 through 999, or an expression of the form =a+b where both operands are signed integers in that range. Values and expressions contain no whitespace.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Keep a hash map from cell id to the raw string. SET with an empty string deletes the key. GET_RAW returns the stored string or empty. GET_COMPUTED checks if the string starts with '='. If not, return it as is, since the literal already displays as its decimal value. If it does, drop the '=' and find the splitting plus. Don't split on the first '+' blindly and don't split on '-'. Operands can be negative, but a '+' only appears as the operator because literals are signed with '-' only. So split on '+', parse both parts as integers, sum, and convert back to a string. The pitfall is parsing with a regex that mishandles '=-9+23', or treating '-0' style inputs oddly. Computing at GET time keeps overwrites trivial. Total cost is O(n). If you freeze, StealthCoder can supply this parser in the live OA.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill In-Memory Spreadsheet Values 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. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Rippling's OA.
Rippling reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
In-Memory Spreadsheet Values FAQ
How hard is the Rippling in-memory spreadsheet question really?+
Easy to medium. The data structure is a plain hash map. The only real difficulty is parsing expressions with negative operands correctly. If you test =-9+23 and =100+2 by hand before submitting, you're covered.
What's the trick to parsing =a+b?+
Strip the leading '=', then split on '+'. Since operands only use '-' as a sign and never '+', there's exactly one plus, the operator. Parse each side with your language's integer parser, which handles the negative sign for you.
Should I evaluate on SET or on GET_COMPUTED?+
Evaluate on GET_COMPUTED. Store only the raw text on SET. That makes GET_RAW trivial, makes overwrites and resets correct automatically, and avoids keeping two representations in sync.
What edge cases should I test?+
Reset with an empty string then both GET types, a GET on a cell never set, a negative first operand, a negative second operand like =5+-3, and overwriting an expression with a literal. Each should return the empty string or the right number.
How do I prepare for this in 48 hours?+
Practice small string-parsing and hash map simulation problems. Write the solution once, run the three examples, and add your own negative-operand tests. Aim for clean code, not cleverness. With up to 10^5 operations, O(1) per operation is plenty.