Any Combined Vector Sequence

Published by mdressler in

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 vectors as shown. You can combine any two elements from different vectors.

{-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 vectors 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

Watch a quick demo on how Edabit works.