Finds the length of the longest subsequence of a given sequence such that all elements of the subsequence are sorted in ascending order.
The Longest Increasing Subsequence (LIS) problem is to find the longest subsequence of a given sequence where the elements are in sorted order. This algorithm uses dynamic programming to store the lengths of LIS ending at each element.