- We need to compare successive data items, use the peek method to get previous one to compare with current one, then pop up the peek or insert current one the the stack.
- Usually need to return a consequence which the length is different from the one passed.
- Math
- iterate the array
- push to stack when it's a number
- otherwise pop two items to calculate
["4", "13", "5", "/", "+"] -> (4 + (13 / 5)) -> 6
- dfd
No comments:
Post a Comment