3890. Smallest Subarray to Sort in Every Sliding Window

Medium
Array
Two Pointers
Stack
Greedy
Sorting
Monotonic Stack

Description

Hints

Hint 1
Solve for each subarray independently.
Hint 2
What are the extreme positions that need to be included in the segment to make the subarray non‑decreasing?

Statistics

Acceptance
59.6%
Submissions
1,102
Accepted
657