problem
solution
option 1 - brute force
1 | class Solution { |
option 2 - sliding window
1 | class Solution { |
option 3 - Binary Search
1 | class Solution { |
1 | class Solution { |
analysis
- option 1
- time complexity
O(n*n)
- space complexity
O(1)
- time complexity
- option 2
- time complexity
O(n)
- space complexity
O(1)
- time complexity
- option 3
- time complexity
O(nlogn)
- space complexity
O(n)
- time complexity