Define dp[i] = length of longest increasing subsequence ending at index i.
For each i, look at all j < i where nums[j] < nums[i]. The LIS ending at i could extend any LIS ending at such j.
dp[i] = 1 + max(dp[j] for all j < i where nums[j] < nums[i]).
Base: dp[i] = 1 (element alone is a valid subsequence).
Answer: max(dp).