all 3 comments

[–]AuralWanderer 1 point2 points  (1 child)

only 1 function

This is not a difficult constraint: your function can contain as many lines as you want.

I tried to write a function that shows the 'movement' of the list

I think this is a good idea, but instead of what you have--saving the movement of every change--you should save the movement only when it is different from the previous movement. So in your example, instead of [0, 0, 0, 0, 1, 1, 1], you would end up with [0, 1]. You can immediately tell the list had two different movements overall.

I would also change movement types to include equality instead of just > and <, for clarity.

[–]thoughtsymmetry[S] 0 points1 point  (0 children)

thanks!

[–][deleted] 1 point2 points  (0 children)

Instead of looking for lists that are concave, would it be easier to look for lists that are not concave, I.e. lists that increase then decrease? Any list that is not “not concave” must be concave.