LeetCode solutions

1556. Make Two Arrays Equal by Reversing Subarrays

My accepted Python solution to LeetCode problem 1556, Make Two Arrays Equal by Reversing Subarrays, running in 4ms.

  • Difficulty: Easy
  • Python
  • Runtime 4ms
  • Memory 17.4MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 4ms, memory 17.4MB, accepted 2025-12-29.

python
class Solution:
    def canBeEqual(self, target: List[int], arr: List[int]) -> bool:
        return sorted(target) == sorted(arr)

Source