This ls some what similar to book allocation, painter partition ans aggressive cow problem
@nicolattu2 жыл бұрын
Genius ! I thought this one was going to be dp in ranges but couldn't solve today 😕 Apart from that I see most people on leetcode do binary search with: mid = left + (right-left)/2 But I find it easier to do mid = (left + right) / 2 Thanks for the video, and please keep it up 💯
@tanson862 жыл бұрын
The reason why they do left + (right-left)/2 is to prevent overflow conditions. If left = Integer.MAX and right = Integer.MAX then the addition will result in an overflow.
@azraazra82732 жыл бұрын
Super bro please continue this work
@CodeWithSunchitDudeja2 жыл бұрын
Sure 👍
@VinayKumar-xs6el7 ай бұрын
line 33 can directly assign current num to totalRunningSum
@greymatters225 ай бұрын
what is time and space complexity? is it TC : O(nlogn) and SC : O(logn) ?
@priyadarshanr2962 жыл бұрын
Can you explain why you chose low=10 initially ? And I feel this to ne hard coz I was not able to think of a binsary search approach here coz the array is undsorted in nature .
@sreejithag12372 жыл бұрын
maximum element in the array will be the minium possible sum if we divide the n elements array to n individual groups.
@xtractcode91332 жыл бұрын
after division the best condiition for the highest number in the array to be the answer itself hence we are taking low = 10 .............
@zero-w1b Жыл бұрын
in this question why are we doing high=mid why not high = mid-1. can someone explain
@neuron8186 Жыл бұрын
bro why you add all hard que to medium have some mercy on us