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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 4ms, memory 17.4MB, accepted 2025-12-29.
class Solution:
def canBeEqual(self, target: List[int], arr: List[int]) -> bool:
return sorted(target) == sorted(arr)