Skip to content

Latest commit

 

History

History

154

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Good morning! Here's your coding interview problem for today.

This problem was asked by Amazon.

Implement a stack API using only a heap. A stack implements the following methods:

  • push(item), which adds an element to the stack
  • pop(), which removes and returns the most recently added element (or throws an error if there is nothing on the stack)

Recall that a heap has the following operations:

  • push(item), which adds a new key to the heap
  • pop(), which removes and returns the max value of the heap