Longest Increasing Subsequence using Dynamic Programming and Patience Sorting