Tap here to switch tabs
Problem
Submissions

Problem: Make Two Arrays Equal by Reversing Subarrays

Make Two Arrays Equal by Reversing Subarrays gives two equal-length integer arrays. Return true if any number of nonempty subarray reversals can make arr identical to target; otherwise, return false.

Statement

You are given two integer arrays of equal length, target and arr. In one operation, you may select any non empty subarray of arr and reverse it in place. You are permitted to perform this operation any number of times.

Return true if arr can be made identical to target, or false otherwise.

Constraints:

  • target.length == arr.length

  • 1≤1 \leq target.length ≤1000\leq 1000

  • 1≤1 \leq target[i] ≤1000\leq 1000

  • 1≤1 \leq arr[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make Two Arrays Equal by Reversing Subarrays

Make Two Arrays Equal by Reversing Subarrays gives two equal-length integer arrays. Return true if any number of nonempty subarray reversals can make arr identical to target; otherwise, return false.

Statement

You are given two integer arrays of equal length, target and arr. In one operation, you may select any non empty subarray of arr and reverse it in place. You are permitted to perform this operation any number of times.

Return true if arr can be made identical to target, or false otherwise.

Constraints:

  • target.length == arr.length

  • 1≤1 \leq target.length ≤1000\leq 1000

  • 1≤1 \leq target[i] ≤1000\leq 1000

  • 1≤1 \leq arr[i] ≤1000\leq 1000