Find the most common element in an array.
Given a non-empty list of integers, return the value with the highest frequency. If multiple values have the same highest frequency, return the one whose first occurrence has the smallest index.
Implement most_common_element(nums); nums is a list of integers and the result is an integer.
def most_common_element(nums):