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