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