Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Check for a common prefix of the two arrays.
After this common prefix, there should be one array similar to the other but shifted by one.
If both arrays can be shifted, return -1.