由网友(离人怎挽心)分享简介:如何找到LIS使用两个数字的长度。例如,[(1,2)(7,8)(3,4)(5,6)]另外,在上述阵列序列,LIS的长度将是3,即[(1,2)(3,4)(5,6)]你知道吗?How to find the length of LIS using two numbers.For example, [(1,2) (...
如何找到LIS使用两个数字的长度。 例如, [(1,2)(7,8)(3,4)(5,6)] 另外,在上述阵列序列,LIS的长度将是3,即 [(1,2)(3,4)(5,6)] 你知道吗?
How to find the length of LIS using two numbers. For example, [(1,2) (7,8) (3,4) (5,6)] In the above array sequence, the length of LIS would be 3. i.e, [(1,2) (3,4) (5,6)] Any idea?
推荐答案
您可以使用任何algorithm对于标准的 LIS问题中,有两个修改:
You could use any algorithm for the standard LIS problem, with two modifications:
忽略任何对其中第二个数字是不严格大于所述第一数量。 的比较运营商对A和B(即 A< b
)需要A的第二个数字比较B的第一号。
Discard any pairs where the second number isn't strictly greater than the first number.
The comparison operator for pairs A and B (i.e. A < B
) needs to compare the second number of A to the first number of B.相关推荐
最新文章