Binary search on the answer
hardThere is no sorted array here at all. What is sorted is the feasibility check - and a monotone boundary is the only thing binary search actually needs. 'Minimise the maximum' problems all reduce to this.
Worst
O(log(range) × cost of the check)Space O(1)Loading the binary search on the answer engine…