Cracking The Coding Interview - Circus Tower Problem (17.8)

Solution 1:

Your solution is wrong. If you run

circus_tower([[1,1],[1,7],[1,9],[2,2],[2,6],[3,3],[3,5],[4,4]])

it returns 2 while the longest subsequence ([1,1]<[2,2]<[3,3]<[4,4]) has length 4.

The problem with your code is that you only find contiguous subsequences.