← Back to challenges

Any Combined List Sequence

PythonHardarrayslogic

Instructions

The goal is to test if a consecutive sequence can be formed. A consecutive sequence is defined as a sequence of incrementing numbers (e.g. 1, 2, 3 or 5, 6, 7, 8). The twist is that you have to consider the combination of lists as shown. You can combine any two elements from different lists.

[-5 1 3 5 ] => [3 5 1 -5 ] => [3+4  5+3  1+8  15-5] = [7 8 9 10] => True
[4 3 8  15] => [4 3 8  15]

Also important is that the lists can be of different sizes, allowing for partially unpaired numbers in some cases.

[2 2 2  ] => [2 2 2 0] => [2+5  2+6  2+7  10+0] = [7 8 9 10] => True
[10 5 6 7] => [5 7 6 10]

Notes

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.