Dynamic-Programming : remove live code & console.log, leave examples as comments.

This commit is contained in:
Eric Lavault
2021-10-10 17:00:21 +02:00
parent 449ef45193
commit 29d2a84090
14 changed files with 95 additions and 124 deletions

View File

@ -3,8 +3,8 @@
* https://en.wikipedia.org/wiki/Longest_increasing_subsequence
*/
function main () {
const x = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15]
// Return the length of the Longest Increasing Subsequence, given array x
function longestIncreasingSubsequence (x) {
const length = x.length
const dp = Array(length).fill(1)
@ -21,7 +21,7 @@ function main () {
}
}
console.log('Length of Longest Increasing Subsequence is:', res)
return res
}
main()
export { longestIncreasingSubsequence }