Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Excel Cell Get/Set Basics
00:00
5 left

Excel Cell Get/Set Basics

HardPython

Problem

Excel sheet: Part 1 implement set_cell("A1", "10") and get_cell("A1"); Part 2 extends set_cell.

Asked in the technical phone screen stage. Part 2+ points-walled.

Implement process_operations(operations), where each operation is a dictionary with op, cell, and, for set, value. Values are integer strings or formulas such as "=A1+B1+4". A get returns the evaluated integer, or null if the cell has never been set. A missing cell referenced inside a formula contributes 0. Updates must affect later reads.

Example: setting A1 to 2, B1 to 3, and C1 to =A1+B1 makes get(C1) return 5. Setting C1 to =B1+4 before setting B1 makes it return 4, then 10 after B1 becomes 6.

Constraints: operations are ordered, formulas contain only +, integer literals, and cell references, and formula references do not form cycles.

Constraints

  • 1 <= operations.length <= 1000
  • Cell names consist of uppercase letters followed by positive digits, such as A1 or Z99
  • A set value is an integer string or a formula beginning with '='
  • Formulas contain only '+' separators, integer literals, and cell references
  • Formula references do not form cycles
  • A direct get of an unset cell returns null; an unset formula reference contributes 0

Function Signature

def process_operations(operations):
Interviewer

Your question is Excel Cell Get/Set Basics. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.