dsa1 min read
Koko Eating Bananas — Binary Search on Answer (Speed)
Find the minimum eating speed for Koko to finish all bananas in h hours using binary search on the answer space.
Read →
webcoderspeed.com
1276 articles
Find the minimum eating speed for Koko to finish all bananas in h hours using binary search on the answer space.
Find the minimum ship capacity to ship all packages within d days using binary search on capacity.
Find any peak element in O(log n) by always moving toward the uphill neighbor, which guarantees finding a peak.
Find the k closest elements to x in a sorted array by binary searching for the optimal left window boundary.
Find the single non-duplicate element in O(log n) by observing that pairs shift the parity of indices after the singleton.