In-Memory Spreadsheet Values
Updated
Problem statement
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]: storevalueincell. A non-empty value is either a signed integer literal such as-9or an expression such as=100+2. Settingvalueto 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
20uppercase letters and digits. - Each operation has one of the documented forms.
- Every non-empty value is either a signed integer from
-999through999, or an expression of the form=a+bwhere both operands are signed integers in that range. - Values and expressions contain no whitespace.
More Rippling Onsite Interview questions
- Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Delivery Cost TrackerPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Maximum Currency Conversion Along a Simple PathPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Top K Frequent WordsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
- Future-Effective Employee SalaryONSITE INTERVIEW · Seen Aug 2026
- Filter and Sort Scheduled TasksONSITE INTERVIEW · Seen Jul 2026
Similar questions at other companies
- File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
- In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
- File Storage ServiceCresta · PHONE SCREENCresta interview questions
- Return Every Matching DecryptionDuolingo · PHONE SCREENDuolingo interview questions
- Reference-Counted Deduplicating File SystemCitadel · PHONE SCREENCitadel interview questions
- Machine Message RouterOpenAI · PHONE SCREENOpenAI interview questions
- Account Scheduler - Availability and AcquireStripe · ONSITE INTERVIEWStripe interview questions
- String Copy and Move LifecycleSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
- Design In-Memory File SystemSnowflake · PHONE SCREENSnowflake interview questions
- Card Transaction StreamCapital One · ONSITE INTERVIEWCapital One interview questions