tests: add tests of LongestIncreasingSubsequence (#1660)

This commit is contained in:
Piotr Idzik
2024-05-23 19:45:08 +02:00
committed by GitHub
parent cc1e1dc643
commit e2b9754862
2 changed files with 27 additions and 0 deletions

View File

@ -6,6 +6,9 @@
// Return the length of the Longest Increasing Subsequence, given array x
function longestIncreasingSubsequence(x) {
const length = x.length
if (length == 0) {
return 0
}
const dp = Array(length).fill(1)
let res = 1