Created
August 14, 2015 18:41
-
-
Save bshlgrs/c390c2c74b006fc09bac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
class MinStack { | |
val myStack = mutable.Stack[Int] | |
def push(item: Int) = myStack.push(item) | |
def pop() = myStack.pop() | |
// BAD! Linear time | |
def getMin() = myStack.min | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment