Let S be the continuous subsequence of numbers in this file that has the greatest product P . What are the first three digits of P ?
For example, for the sequence [1, 6, 2, -1, 2], S = [1, 6, 2], and P = 12.
Click here to open the file.
Details and assumptions
Assume that the product of a single number is itself.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Use the following python code to get a generator for the subsequences of a sequence:
Then, use this python code to find the maximum product of a subsequence, by first extracting the data into a list of ints, then iterating over every subsequence and replacing the "ans" variable with the product if the product is greater than it.