Problem · Array
Subarray Removal
Given an array arr of n integers, find the number of its subarrays such that removing the subarray creates a non-empty array that is sorted in increasing order.
Note: A subarray is defined as any contiguous segment of the array.
Examples
01 · Example 1
arr = [1, 2, 1, 2] return = 7

Constraints
O_OMore The D. E. Shaw Group problems
public int subarrayRemoval(int[] arr) {
// write your code here
}
arr[1, 2, 1, 2]
expected7
sign in to submit