Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
most-frequent-even-element.json34 linesDownload Raw Back to root
1{2  "id": 2486,3  "name": "most-frequent-even-element",4  "difficulty": "Easy",5  "link": "https://leetcode.com/problems/most-frequent-even-element/",6  "date": "2022-09-04",7  "task_description": "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`. **Example 1:** ``` **Input:** nums = [0,1,2,2,4,4,1] **Output:** 2 **Explanation:** The even elements are 0, 2, and 4. Of these, 2 and 4 appear the most. We return the smallest one, which is 2. ``` **Example 2:** ``` **Input:** nums = [4,4,4,9,2,4] **Output:** 4 **Explanation:** 4 is the even element appears the most. ``` **Example 3:** ``` **Input:** nums = [29,47,21,41,13,37,25,7] **Output:** -1 **Explanation:** There is no even element. ``` **Constraints:** `1 <= nums.length <= 2000` `0 <= nums[i] <= 105`",8  "test_case": [9    {10      "label": "Example 1",11      "input": "nums = [0,1,2,2,4,4,1]",12      "output": "2 "13    },14    {15      "label": "Example 2",16      "input": "nums = [4,4,4,9,2,4]",17      "output": "4 "18    },19    {20      "label": "Example 3",21      "input": "nums = [29,47,21,41,13,37,25,7]",22      "output": "-1 "23    }24  ],25  "constraints": [26    "1 <= nums.length <= 2000",27    "0 <= nums[i] <= 105"28  ],29  "python_template": "class Solution(object):\n    def mostFrequentEven(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: int\n        \"\"\"\n        ",30  "java_template": "class Solution {\n    public int mostFrequentEven(int[] nums) {\n        \n    }\n}",31  "metadata": {32    "func_name": "mostFrequentEven"33  }34}