To start, here are some examples.
['d', 'b', 'c', 'd', 'e']
['c', 'd', 'e', 1, 2]
// desired result: [1, 2]
[1, 2, 3]
[2, 3, 4]
// desired result: [4]
['Hello', 'Goodbye', 'Goodbye', 'Hello']
['Goodbye', 'Hello', 'Goodbye', 'Goodbye']
// desired result: ['Goodbye', 'Goodbye']
The elements are shifted n indexes (where n is less than the length of both arrays). The arrays are always the same length. They are always shifted from the right side of the array. Is there a way to do this?
I was thinking of finding the largest subset in both arrays then taking the right or something. Can't find a great way to approach it