Microsoft Interview Question

It was a DSA question whose solution was based on LIS