Let $\sigma$ be a permutation on {$1,...,n$}. We want to find the largest $m$ such that there exists an increasing subsequence $j_1, j_2, ..., j_m$ for which $\sigma(j_1), \sigma(j_2), ..., \sigma(j_m)$ is also increasing. Describe an algorithm which will determine $m$ using $O(n^2)$ time and $O(n)$ memory.
Solution Attempt:
Step 1: Store the list $\sigma(1),\sigma(2),...,\sigma(n)$ for reference.
Step 2: Check if $\sigma$ is the identity. If yes, we are done as $m = n$. Otherwise continue to step 3.
Step 3: Delete exactly one value from the list and check if the resulting sequence is increasing. Do this for each value. If we find one at any point we are done. Otherwise continue to Step 4.
Step 4: Delete exactly two values from the list and check if the resulting sequence is increasing... etc.
And so on, until we find $m$. I'm not sure how to check if this algorithm satisfies the conditions, though.