Find Longest Increasing Subsequence

Advanced

Find Longest Increasing Subsequence

Hey there, little code explorer! 🐱‍💻 Are you ready for a fun coding challenge? Today, we have a quest for you: find the longest sequence of numbers in an array that keeps increasing. That's right! We're going on a treasure hunt, and the treasure is the longest stretch of numbers that go up and up, like climbing a mountain.

Here's what we need you to do:

Write a function called find_longest_increasing_subsequence that takes a list of numbers and returns the longest increasing subsequence as a list.

For example:

find_longest_increasing_subsequence([3, 10, 2, 1, 20])

The longest increasing subsequence is [3, 10, 20], so your function should return:

[3, 10, 20]

Another example:

find_longest_increasing_subsequence([3, 2, 6, 4, 5, 1, 7])

Here, the longest increasing subsequence is [2, 4, 5, 7], so the function should return:

[2, 4, 5, 7]

Tip: Make sure to carefully track the longest sequence as you examine every possibility!

Have fun on your coding adventure! 🎉🐍

Geek
Inputs

Arg 1:

[3,10,2,1,20]
Expected Output
[3, 10, 20]
Actual Output
Find Longest Increasing Subsequence [advanced] | Coding for Kids