Maintain 0 for initial values of i upto R Once i = R , then we need to erase that 0 from our multiset as our first index of subarray cannot be 0 anymore .
s1 . append ( 0 ) NEW_LINE ans = - sys . maxsize - 1 NEW_LINE ans = max ( ans , pre [ L - 1 ] ) NEW_LINE