problem
solution
option 1 - Two Pointers
1 | class Solution { |
option 2 - Binary Search
1 | class Solution { |
analysis
- option 1
- times complexity
O(n)
- space complexity
O(1)
- times complexity
- option 2
- times complexity
O(nlogn)
- space complexity
O(1)
- times complexity