Find max length super array
Anonymous User
215

Question:
Given an array of distinct integers. Find 2 non-overlapping subarrays such that the concatenation of 2 subarrays gives an increasing array called super array. Find the max length of super array possible.

Example:
arr = [7, 1, 2, 5, 8, 6, 3, 9, 10, 11]

In the given array the subarrays [1, 2, 5, 8] and [9, 10, 11] when concatenated results in [1, 2, 5, 8, 9, 10, 11],
which is the max length super array with length 7 for array arr.

Constraints
1 <= arr.length <= 100000

Can anyone explain how to solve this question ?

Comments (0)