Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longest increasing subsequence #16

Open
antondurinin opened this issue Dec 6, 2024 · 0 comments
Open

Longest increasing subsequence #16

antondurinin opened this issue Dec 6, 2024 · 0 comments

Comments

@antondurinin
Copy link

antondurinin commented Dec 6, 2024

Тут есть задача 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.

This was referenced Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant