12
1
Given a list of positive integers, write code that finds the length of longest contiguous sub-list that is increasing (not strictly). That is the longest sublist such that each element is greater than or equal to the last.
For example if the input was:
\$[1,1,2,1,1,4,5,3,2,1,1]\$
The longest increasing sub-list would be \$[1,1,4,5]\$, so you would output \$4\$.
Your answer will be scored by taking its source as a list of bytes and then finding the length of the longest increasing sub-list of that list. A lower score is the goal. Ties are broken in favor of programs with fewer overall bytes.
Is it okay to return true instead of 1? And do we have to handle an empty list? – Jo King – 2018-10-08T05:28:30.987
For your first one, whatever meta consensus is on numeral output you may do, I don't recall
True
being a substitute for1
but it may be. You should be able to handle the empty list (Output is of course 0). – Post Rock Garf Hunter – 2018-10-08T07:12:25.1832Suggested test cases:
[] => 0
,[0] => 1
,[3,2,1] => 1
,[1,2,1,2] => 2
– Sok – 2018-10-08T08:22:58.287Would you mind elaborating on the 'score' a bit more? – ouflak – 2018-10-08T09:58:19.267
1@ouflak I'm not sure what more there is to say on the score. Convert your submission to a list of bytes and pass it through your own program and that's your score. If scores are equal, the tie-breaker is the bytecount – Jo King – 2018-10-08T10:19:06.340
You really should add those test cases. It seems like a majority of these answers don't handle the empty list case correctly. – Jo King – 2018-10-10T07:55:49.527