776 B
776 B
Series
Write a program that will take a string of digits and give you all the possible consecutive number series of length n
in that string.
For example, the string "01234" has the following 3-digit series:
- 012
- 123
- 234
And the following 4-digit series:
- 0123
- 1234
And if you ask for a 6-digit series from a 5-digit string, you deserve whatever you get.
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 subset of the Problem 8 at Project Euler view source