Notes, News and Tutorials about Java World and Related Technologies just for fun!
CATEGORIES
HOME
PROJECTS
Saturday, April 11, 2020
Basic Stack Implementation to Find the Mimum Element in Constant Time
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
https://leetcode.com/explore/featured/card/30-day-leetcoding-challenge/529/week-2/3292/
>> Solution 1 : Simple linked list, keep minimum in each node
O(1) time complexity, O(n) space complexity
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment