1460. Make Two Arrays Equal by Reversing Subarrays
- Sort
class Solution {
public:
bool canBeEqual(vector<int>& target, vector<int>& arr)
{
sort(target.begin(), target.end());
sort(arr.begin(), arr.end());
for (int i = 0; i < target.size(); ++i)
{
if (target[i] != arr[i]) return false;
}
return true;
}
};
- T:
- S: