Return the amount of longest (non-decreasing) sorted sequence of integers in a list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Return the amount of longest (non-decreasing) sorted sequence of integers in a list

"Write a function named longest_sorted_sequence that accepts a list of integers as a parameter and that returns the length of the longest sorted (nondecreasing) sequence of integers in the list. For example, if a variable named list stores the following values: list = [3, 8, 10, 1, 9, 14, -3, 0, 14, 207, 56, 98, 12] then the call of longest_sorted_sequence(list) should return 4 because the longest sorted sequence in the list has four values in it (the sequence -3, 0, 14, 207). Notice that sorted means nondecreasing, which means that the sequence could contain duplicates." I'm not sure how to go about solving this problem...

31st Mar 2018, 12:59 AM
Taylor Deal
Taylor Deal - avatar
1 Answer
+ 3
I did more than requested. The function returns the longest sublist or lists if there are more than one in the list. But to answer the original question. just return c. https://code.sololearn.com/cAmQNPLcsRHC/?ref=app
31st Mar 2018, 8:27 AM
Louis
Louis - avatar