Tap here to switch tabs
Problem
Submissions

Problem: Make Two Arrays Equal by Reversing Subarrays

med
30 min
Try to solve the Make Two Arrays Equal by Reversing Subarrays problem.

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

med
30 min
Try to solve the Make Two Arrays Equal by Reversing Subarrays problem.

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