Problem 2771 · Medium

Longest Non-decreasing Subarray From Two Arrays

Track the longest non-decreasing run ending at each index for each source choice, and switch sources when the values allow it.

Open the interactive visualisation