input: Write a function to find the most common elements in an array of integers. The function should return a list of all elements that appear with the highest frequency in the given array. If the array is empty, return an empty list.
  def most_common(nums):
      # Create a dictionary to store the counts
      counts = {}
  
      # Iterate over the elements
      for num in nums:
          # If the element is not present in the dictionary, add it
          if num not in counts:
              counts[num] = 0
  
          # Update the count
          counts[num] += 1
  
      # Get the maximum count
      max_count = max(counts.values())
  
      # Return the elements that have maximum count
      return [num for num, count in counts.items() if count == max_count]
  
  assert most_common([3, 4, 1, 2, 5, 3, 3])==[3]
  assert most_common([3, 4, 1, 1, 5, 3, 3])==[3]
  assert most_common([4, 4, 1, 1, 5, 5, 5])==[5]
  assert most_common([3, 3, 3, 1, 1, 1])==[3, 1]
  assert most_common([])==[]
output: def most_common(nums):
      counts = {}
      for num in nums:
          if num not in counts:
              counts[num] = 0
          counts[num] += 1
      if not counts:
          return []
      max_count = max(counts.values())
      return [num for num, count in counts.items() if count == max_count]