On 20/07/16 22:11, monik...@netzero.net wrote: > ... if not in python, then in pseudo code.
The first question to ask is can you do it without a computer? In other words given input [1,7,2,3,5,4,6] Can you first of all produce a list of all valid runs? [1,2,3,5,6] and [1,2,3,4,6] both have length 5 I also see shorter runs: [7] and [4,6] for example. Can you manually create a list of all valid runs? Once you can do that can you write a program to generate that as a list of lists in Python? If so then the answer to your question is a matter of finding the length of the longest valid run which should be fairly easy. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor