LIS basic dynamic programming