Google Interview Question

LIS with a slight twist.