Stack
Valid Parentheses
Link: https://leetcode.com/problems/valid-parentheses/
Code:
Stack is FILO (First In Last Out);
Stack methods:
push()
,pop()
,isEmpty()
;HashMap methods:
containsKey()
,get()
,put()
;Time complexity: O(n);
Simplify Path
Link: https://leetcode.com/problems/simplify-path/
Code:
Stack can not pop when it is empty;
Java stack method
push()
vs.add()
: see stackoverflow;split()
method for String;equals()
method for String;
Last updated