[
hash table
counter
]
BinarySearch 0514 Reverse Sublists to Convert to Target
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)