Skip to content

Longest increasing subsequence #16

Open
@antondurinin

Description

@antondurinin

Тут есть задача Finds the length of the longest increasing subsequence of a given array of integers.
И согласно этой задачи и математическому опредению Longest increasing subsequence (LIS), это любая последовательность возрастающая внутри рада чисел.

In the first 16 terms of the binary Van der Corput sequence

0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
one of the longest increasing subsequences is

0, 2, 6, 9, 11, 15.

В задаче как раз это просят найти, но в тестах ответы не отвечающие опредлению

// findLongestIncreasingSubsequence
it.optional(
'findLongestIncreasingSubsequence should return a length of the longest increasing subsequence',
() => {
[
{
arr: [10, 22, 9, 33, 21, 50, 41, 60, 80],
expected: 3,
},
{
arr: [3, 10, 2, 1, 20],
expected: 2,
},
{
arr: [50, 3, 10, 7, 40, 80],
expected: 3,
},
{
arr: [41, 60, 80, 10, 22, 9, 33, 21, 50],
expected: 3,
},
].forEach((data) => {
const actual = tasks.findLongestIncreasingSubsequence(data.arr);
assert.strictEqual(data.expected, actual);
});
}
);

В первом должно быть 6 и в 4-м 4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions