The problem is quite similar to the LCS not LIS. The statement in this basic solution is incorrect.
Thanks @Franklin for pointing this out! We have fixed this.