You work for a government agency that has intercepted a series of encrypted communication signals from a group of bank robbers. The signals contain a long sequence of digits. Your team needs to use various digital signal processing techniques to analyze the signals and identify any patterns that may indicate the planning of a heist.
Your task is to look for patterns in the long sequence of digits in the encrypted signal.
The technique you're going to use here is called the largest series product.
Let's define a few terms, first.
Let's work through an example, with the input "63915"
.
3
, there will be three possible series:
"639"
"391"
"915"
"639"
is 162 (6 Γ 3 Γ 9 = 162
)"391"
is 27 (3 Γ 9 Γ 1 = 27
)"915"
is 45 (9 Γ 1 Γ 5 = 45
)"63915"
is from the series "639"
.
So the answer is 162.Sign up to Exercism to learn and master Wren with 99 exercises, and real human mentoring, all for free.