Tag view

#design

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with design

3 cards

Python Medium Theory

Encapsulation, abstraction, polymorphism, and composition vs inheritance

Encapsulation organizes state and behavior, abstraction hides unnecessary detail, polymorphism lets different objects satisfy the same interface, and composition often keeps designs looser than inheritance.

  • Composition favors explicit relationships
  • Polymorphism is about substitutable behavior
  • Python uses conventions more than strict access control

Encapsulation, abstraction, polymorphism, and composition vs inheritance

Coding Exercises Medium O(1)

LRU Cache

Store items in an OrderedDict, move keys to the end whenever they are read or updated, and evict the oldest item when capacity is exceeded.

Implement an LRU cache with O(1) get and put operations.

Coding Exercises Medium O(1)

Min Stack

Push each value onto the main stack and also onto a min stack whenever it is less than or equal to the current minimum. When popping, remove it from the min stack too if it matches the current minimum.

Implement a stack that supports push, pop, top, and get_min in constant time.