Find the most frequently occurring element (count occurrences); give multiple approaches.
Asked in the Technical Round 1 stage. Given a non-empty array of integers, return the element with the highest frequency. If multiple elements tie, return the one that appears first in the input array.
nums is a non-empty list of integers. Return one integer from nums.
def most_frequent_element(nums):