Deslocamento circular
Escreva um método que receba dois arrays (arr1 e arr2) e um inteiro n, e retorne true se o segundo array for igual ao primeiro array deslocado n posições. Caso contrário, retorne false.
Exemplos
Program.circularShift(new int[]{1, 2, 3, 4}, new int[]{3, 4, 1, 2}, 2) ➞ true
Program.circularShift(new int[]{1, 1}, new int[]{1, 1}, 6) ➞ true
Program.circularShift(new int[]{0, 1, 2, 3, 4, 5}, new int[]{3, 4, 5, 2, 1, 0}, 3) ➞ falseObservações
- Os dois arrays terão o mesmo tamanho.
npode ser um valor negativo.