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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
Toy App with Increasing Requirements
00:00
5 left

Toy App with Increasing Requirements

MediumPython

Problem

Tell me about building a toy application that meets a series of increasingly complex requirements, from initial MVP to later enhancements.

Implement run_toy_app(operations) as a deterministic in-memory application. Support adding, reading, updating, deleting, and listing records by optional ID prefix. Return one result for each operation, sorting listed IDs lexicographically.

The input is a list of operation dictionaries, and the output is a list. Values are integers. get returns null for a missing ID; add, update, and delete return booleans.

Constraints

  • 0 <= operations.length <= 10^4
  • Each operation has a valid operation type: add, get, update, delete, or list
  • Record IDs are non-empty strings
  • Record values are integers
  • A list operation may omit prefix, which means all records should be included
  • IDs in list results must be sorted lexicographically

Function Signature

def run_toy_app(operations):
Interviewer

Your question is Toy App with Increasing Requirements. 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.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.