mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 16:26:47 +08:00
Dynamic-Programming : remove live code & console.log, leave examples as comments.
This commit is contained in:
@ -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 }
|
||||
|
Reference in New Issue
Block a user