sub.nums.
a. If sub is empty or the current number is greater than the last element in sub, append the number to sub.
b. Otherwise, use binary search to find the first element in sub that is not smaller than the current number and replace that element with the current number.sub is the length of the longest increasing subsequence.