You are given two nums and removeQueries, both of length n. For each query from nums at the index removeQueries[i] is marked as removed.
A segment is defined as a contiguous subsequence of non removed elements in nums. The sum of a segment is the sum of all elements present in that segment.
You need to process the queries sequentially. After each query, determine the maximum segment sum among all active segments. If no segments remain, the maximum segment sum is
Return an integer array ans of length n, where ans[i] represents the maximum segment sum after applying the
Constraints:
n nums.length removeQueries.length
n
nums[i]
removeQueries[i] n
All the values of removeQueries are unique.
You are given two nums and removeQueries, both of length n. For each query from nums at the index removeQueries[i] is marked as removed.
A segment is defined as a contiguous subsequence of non removed elements in nums. The sum of a segment is the sum of all elements present in that segment.
You need to process the queries sequentially. After each query, determine the maximum segment sum among all active segments. If no segments remain, the maximum segment sum is
Return an integer array ans of length n, where ans[i] represents the maximum segment sum after applying the
Constraints:
n nums.length removeQueries.length
n
nums[i]
removeQueries[i] n
All the values of removeQueries are unique.