1460 Make Two Arrays Equal By Reversing Subarrays | Sorting | HashMap | Java Solution | Leetcode

Поделиться
HTML-код
  • Опубликовано: 2 янв 2025

Комментарии •

  • @RASIUT
    @RASIUT 5 месяцев назад

    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