Binary search on the answer: when nothing is sorted but you can still binary search
Students learn binary search as "find x in a sorted array" and then get stuck on questions where nothing is sorted. The trick is that you are not searching the array. You are searching the answer . The problem You have packages with weights w[i] that must be shipped in order. A ship carries them over D days, loading packages in order each day until the next one would exceed its capacity. What is the minimum capacity…