Is the example in the description wrong?

  • 0

    "For example,
    Given [10, 9, 2, 5, 3, 7, 101, 18],
    The longest increasing subsequence is [2, 3, 7, 101], therefore the length is 4. Note that there may be more than one LIS combination, it is only necessary for you to return the length."

    Why [2, 3, 7, 101] is a subsequence of the original?

  • 1

    A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. Resulting elements do not need to be contiguous in the original sequence.

  • 0

    Got you! Thanks for explanation!

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.