DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Dynamic Container

A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
hard
Seniority
L4

Problem

You're implementing a dynamic array from scratch (the kind that backs a built-in `list`) and exercising it with a replay log of commands in `ops`, where each entry's first element names the operation: `['append', val]` adds `val` to the end, `['get', index]` reads the element at that position, `['size']` reads the current element count, and `['remove', index]` deletes the element at that position and shifts everything after it one place left. Manage your own backing storage that grows as elements are added rather than leaning on the standard library to resize for you. Replay the commands in order and return the values produced by the `get` and `size` operations only, in the order they occur, since `append` and `remove` produce no output.

Summary

Grow your own storage before the standard library does it for you.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons