The DP gives you the length, but which elements form the LIS? Track predecessors. When you update , record .
This creates a chain of predecessors. Find the index with maximum value. Follow pointers backward, collecting elements. Reverse at the end. For : start at index (value ), follow back through to get .