Last active
May 21, 2017 06:49
-
-
Save ttowncompiled/4d433644878bb082ed5261dd4b035ac0 to your computer and use it in GitHub Desktop.
A Stack to use for HackerRank problems.
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
### | |
# Python 3 | |
# S = [] | |
### | |
def size(S): | |
return len(S) | |
def is_empty(S): | |
return len(S) == 0 | |
def peek(S): | |
return S[-1] if len(S) > 0 else None | |
def push(S, x): | |
S.append(x) | |
def pop(S): | |
return S.pop() if len(S) > 0 else None | |
# The End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment