[Tutor] python programmin problem
alan.gauld at yahoo.co.uk
Wed Jul 20 19:11:24 EDT 2016
On 20/07/16 22:11, monikajg at 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
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:
 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.
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor