Intuition
Pretty straighforward, we make a frequency table for all the elements in array. Then we extract only the distinct characters, and return k-th
character.
Code
Python3
Big O Analysis
-
Runtime
The runtime complexity here is since we use the Counter object which would require N time to create a frequency table.
-
Memory
The memory usage is since we use the Counter which inherently is a python
dict
.
— A