![]() |
VOOZH | about |
Create a customized data structure such that it has functions :-
All the functions should be of O(1)
Question Source : amazon interview questions
Approach :
Implementation:
5 inserted successfully 7 inserted successfully 3 inserted successfully min element :: 3 removed successfully 2 inserted successfully 9 inserted successfully Last element :: 9 0 inserted successfully min element :: 0 removed successfully 11 inserted successfully min element :: 2
Time complexity: Each function runs in O(1)
Auxiliary space: O(n) for stack