This is my first attempt at a Code Golf question. If it needs obvious edits, please feel free to make them.

Below is a description of the basic Dropsort algorithm.

Dropsort is run on a list of numbers by examining the numbers in sequence, beginning with the second number in the list. If the number being examined is less than the number before it, drop it from the list. Otherwise, it is in sorted order, so keep it. Then move to the next number.

After a single pass of this algorithm, the list will only contain numbers that are at least as large as the previous number in the list. In other words, the list will be sorted!

For example, given a list of numbers 1,65,40,155,120,122, the 40,120,122 numbers will be dropped, leaving 1,65,155 in the sorted list.

Let's implement a new sorting algorithm called DropSortTwist.

This sort is identical to Dropsort except that a number (including the first number) that would be kept in Dropsort may optionally be dropped instead. DropSortTwist must return (one of) the longest possible sorted list.

For example, using the same list of numbers as above, DropSortTwist must return either 1,65,120,122 or 1,40,120,122. In both cases the 155 number is dropped to achieve a sorted list of length 4, one greater than the Dropsort list.

In this task, you will be given a list of integers as input (STDIN or function argument, you are required to support at least the range of 8-bit signed integers.) You must return the longest possible increasing subsequence.

\$\begingroup\$Welcome to the site! If I understood this correctly you want the Longest increasing subsequence? While the motivations for the challenge are nice it would be best if you could describe the task without relying on users to follow to other links.\$\endgroup\$
– Sriotchilism O'ZaicAug 9 at 15:29

\$\begingroup\$@SriotchilismO'Zaic: Thank you! I have tried to clarify the question and reduce the links.\$\endgroup\$
– JamesAug 9 at 15:40

\$\begingroup\$Probable dupe, but it is an older question with a different output format (length of subsequence) and some restrictions on time\$\endgroup\$
– Jo KingAug 9 at 15:44

4

\$\begingroup\$I disagree that this is a dupe. The timing restriction is very significant. I'd expect all serious answers to this question to fail the timing requirements of the older one (my answer sure does).\$\endgroup\$
– GrimyAug 9 at 16:13

2

\$\begingroup\$Agreed, I do not think this is a dupe of that dupe target since that one restricts the input domain to [1,999] and implements a "must execute this (1000 entry test case) in a 'timely manner'" restriction, making competitive answers unlikely to be transferable in either direction.\$\endgroup\$
– Jonathan AllanAug 9 at 17:30

Your Answer

If this is an answer to a challenge…

…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.

…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.

…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.

More generally…

…Please make sure to answer the question and provide sufficient detail.

…Avoid asking for help, clarification or responding to other answers (use comments instead).

Code Golf Stack Exchange is a site for recreational programming competitions, not general programming questions. Challenges must have an objective scoring criterion, and it is highly recommended to first post proposed challenges in the Sandbox.