i'm trying to get the 5 most occurings elements and their count of occurence out of a list. I solved it with a solution that works in time complexity O(5*n*n).
Is there an optimal solution with a better time complexity?
Example Input:
[['16.37.123.153','119.222.456.130','38673','161','17','62','4646']
['16.37.456.153','119.222.123.112','56388','161','17','62','4646']..]
Example Output:
MostOccurrentElements = [['16.37.123.153','119.222.456.130','38673','161','17','62','4646']..]
Counter = [134, ..]
With first element of MostOccurrentElements List going with first element of Counter List.