problem
solution
option 1 - two pass
1 | class Solution { |
option 2 - one pass
1 | class Solution { |
option 3 - vector instead of hash
1 | class Solution { |
analysis
- time complexity
O(n)
- space complexity
O(1)
1 | class Solution { |
1 | class Solution { |
1 | class Solution { |
O(n)
O(1)