jeudi 25 mai 2017

How to shift a sequence in front of another and sum intersection?

I have two string arrays (array length = 19) and I have to shift one in front of the other and save the concatenated strings in another string array.

Example:

array1: A B C array2: D E F

*first iteration:

A B C
    D E F

intersection = CD => my result array will have on it's first position "CD"

*second iteration:

A B C
  D E F

intersection = CE and BD => my result array will have on it's second position "CE+BD"

*and so on till array2 is fully shifted to the left, the last iteration being:

    A B C
D E F

intersection = AF => my result array will have on it's last position "AF"

Aucun commentaire:

Enregistrer un commentaire