Problem 2972 · Hard
Fix the kept prefix and count the removable middles with a pointer into the increasing suffix.
Open the interactive visualisation