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 . push ( 0 ) ; let ans = Number . MIN_VALUE ; ans = Math . max ( ans , pre [ L - 1 ] ) ;