Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Design an immutable stack where mutations create new versions without altering existing ones.
All operations including push, pop, peek, and size must execute in O(1) time.
Previous stack states must remain fully accessible through reference sharing.
What This Tests
Immutable data structures and structural sharing
Linked list node manipulation and reference tracking
Time complexity analysis under immutability constraints
Functional programming paradigms in OOP languages
Common Patterns
Linked List
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Stdout
-