Skip to content

Practice Most Frequent Even Element

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2404
LeetCode Problem

Most Frequent Even Element

Problem Statement

Given an integer array nums, return the most frequent even element. If there is a tie, return the smallest one. If there is no such element, return -1.

Source: Most Frequent Even Element on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [0,1,2,2,4,4,1]
Output
2

# Example 2

Input
nums = [4,4,4,9,2,4]
Output
4

# Example 3

Input
nums = [29,47,21,41,13,37,25,7]
Output
-1

Constraints

1 <= nums.length <= 2000
0 <= nums[i] <= 10^5

Related LeetCode Problems

Practice more problems similar to Most Frequent Even Element.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.