we were asked to reverse actually no doubt we can do it without reversing but if we want to reverse then we can use class Solution { public static void swap(int[] arr, int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } public boolean canBeEqual(int[] target, int[] arr) { int n = target.length; for(int i=0;i
we were asked to reverse actually no doubt we can do it without reversing but if we want to reverse then we can use
class Solution {
public static void swap(int[] arr, int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
public boolean canBeEqual(int[] target, int[] arr) {
int n = target.length;
for(int i=0;i
Yes