878 B
878 B
Largest Series Product
Write a program that, when given a string of digits, can calculate the largest product for a series of consecutive digits of length n.
For example, for the input '0123456789'
, the largest product for a
series of 3 digits is 504 (7 * 8 * 9), and the largest product for a
series of 5 digits is 15120 (5 * 6 * 7 * 8 * 9).
For the input '73167176531330624919225119674426574742355349194934'
,
the largest product for a series of 6 digits is 23520.
To run the tests simply run the command go test
in the exercise directory.
If the test suite contains benchmarks, you can run these with the -bench
flag:
go test -bench .
For more detailed info about the Go track see the help page.
Source
A variation on Problem 8 at Project Euler view source