This problem specifically asks for a divide and Conquer algo but gets TLE…kadane’s algo does fine although
TLE on the Divide And Conquer Approach
actually there is a divide and conquer approach using segment tree also …which will not give a TLE , but kadane’s algorithm is the best
why would segment tree make a difference… since there arent any updations why will it be faster then a normal divide and conquer algo?
if the queries are of type l to r , then segment tree approach is best in use,
tell the maximum subarray sum from l to r, so we can say query(0,n-1)
1 Like