Solve the Longest Increasing Subsequence problem (LeetCode 300).
Implement length_of_lis(nums), which returns the length of the longest strictly increasing subsequence of an integer array. A subsequence preserves relative order but may omit elements, and equal consecutive values do not increase its length.
Input: nums, a list of integers. Output: an integer representing the maximum subsequence length.
def length_of_lis(nums):