Problem statement

https://binarysearch.com/problems/Reverse-Sublists-to-Convert-to-Target/

Solution

All we need to check is that counters of two lists are the same.

Complexity

It is O(n + m) for time and space.

Code

class Solution:
    def solve(self, nums, target):
        return Counter(nums) == Counter(target)