Given a list, your task is to determine the list is K percent same i.e has element that is populated more than K % times.
Given below are few methods to solve the task.
Method #1 Using collections.Counter
Initial list [1, 2, 3, 1, 1, 1, 1, 1, 3, 2] True
Method #2: Using dictionary and its values
initial list [1, 2, 3, 1, 1, 1, 1, 1, 1, 1] True
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course