problem
solution
option 1
1 | class Solution { |
option 2
1 | class Solution { |
option 3 - stack
1 | class Solution { |
option 4 - improved stack
1 | class Solution { |
analysis
- option 1
- time complexity
O(n)
- space complexity
O(n)
- time complexity
- option 2
- time complexity
O(n)
- space complexity
O(1)
- time complexity
- time complexity
O(n)
- space complexity
O(n)
- time complexity
- option 4
- time complexity
O(n)
- space complexity
O(1)
- time complexity