dsa1 min read
Capacity to Ship Packages Within D Days — BS on Answer
Find the minimum ship capacity to ship all packages within d days using binary search on capacity.
Read →
1575 articles
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.
Find the length of LIS in O(n log n) using patience sorting: binary search to maintain a sorted tails array.