Description:
Solution:
We are gonna set l, r, m pointers to find in O(logn).
If l pointer value is less than m pointer value:
- target should be between l and m or between m and r.
- if target is more than m value or target is less than l value, we are gonna see right portion, except left portion.
- else we are gonna see left portion, except right portion.
If r value is less than m value:
- target can be between l and m or between m and r.
- if target is less than m value or target is more than r value, we are gonna see the left portion except right portion.
- else we are gonna see right portion, except left portion.
'LeetCode ๐๏ธ > Array' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
11. Container With Most Water (0) | 2023.06.01 |
---|---|
15. 3Sum (0) | 2023.05.31 |
153. Find Minimum in Rotated Sorted Array (0) | 2023.05.29 |
152. Maximum Product Subarray (0) | 2023.05.28 |
53. Maximum Subarray (0) | 2023.05.27 |