Longest chain of pairs
问题 You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. A pair (c,d) can follow (a,b) if and only if b is less than c . Chains of pairs can be formed in this manner. Find the longest chain of pairs formed. I got this question in an interview with Amazon but couldn't figure out the answer, just that it is related to the LIS problem. 回答1: Because the two values of each (X,Y) pair must be in order (X < Y), and the Y value of one pair must be