Examples :
Input: [2, 1, 2, 2, 1, 3] Output: 2 Input: [’Dog’,’ Cat’, ’Dog’] Output: Dog
Approach # 1: Naive Appraoh
This is a brute force method in which we use a for loop to count the frequency of each element. If the current frequency is greater than the previous frequency, update the counter and save the element.

Exit:
2
Approach # 2. Pythonic Naive Appraoch
Create a set from the list so that duplicate elements are removed. Then find the largest number of occurrences of each element in the set, and that way we will find the most of it.

Exit :
2
Approach # 3 Using counter
Use a Python counter that returns the count of each item in a list. This way we simply find the most common element using most_common ()
.

Exit :
2
Approach # 4: by finding the mode
Finding the most frequent item means the search mode in the list. Therefore, we are using the mode method from statistics.

Exit :
2
Approach # 5 Using a Python Dictionary
Use a Python Dictionary to store an element as a key and its frequency as a value and thus find the most frequent element.

Exit :
2