[
counter
hash table
]
BinarySearch 0274 Equivalent Value and Frequency
Problem statement
https://binarysearch.com/problems/Equivalent-Value-and-Frequency/
Solution
Just use counter here.
Complexity
It is O(n)
for time and space.
Code
class Solution:
def solve(self, nums):
return any(x == y for x, y in Counter(nums).items())