Ezvor

3269. Constructing Two Increasing Arrays

HardArray Preparing judge… LeetCode
ArrayDynamic Programming

Hints

Hint 1
Think of dynamic programming.
Hint 2
Define dp[i][j][flag] as the answer to the problem if we only consider the first i elements of the first array, the first j elements of the second array, and flag is either 0 or 1 indicating which array contains the largest element.