The following question was asked in my combinatorics exam -
“Let $n$ be a positive integer. Exhibit an arrangement of integers between $1$ to $n^2$ which has no increasing or decreasing subsequence of length $n + 1$.”
This question has a very similar structure to the Rosen’s subsequence theorem, and I am aware of its proof using the pigeonhole principle, as given in the link above by @Rajdeep.
But i am not really sure on how to provide the requisite construction for my question above — the pigeonhole principle fails here as we have $n^2$ numbers and $n^2$ pairs, if we proceed in a similar fashion as done in the proof linked above.
So could somebody provide me with some hints or solutions ? I may be completely wrong as well in the using pigeonhole principle for this problem, so different solutions are also welcomed.