Convert the occurences .values()
into a set, and check if it’s same as the number of keys .keys()
. If it’s same that means there’s no two frequencies that are same.
Code
Python3
Big O Analysis
-
Runtime
The runtime complexity here is since that’s the cost of converting a list to a set.
-
Memory
The memory usage is since we use
set()
.
— A