CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes561downloads
1{2    "id": 3242,3    "name": "count_elements_with_maximum_frequency",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/count-elements-with-maximum-frequency/",6    "date": "2024-01-07 00:00:00",7    "task_description": "You are given an array `nums` consisting of **positive** integers. Return _the **total frequencies** of elements in__ _`nums` _such that those elements all have the **maximum** frequency_. The **frequency** of an element is the number of occurrences of that element in the array. **Example 1:** ``` **Input:** nums = [1,2,2,3,1,4] **Output:** 4 **Explanation:** The elements 1 and 2 have a frequency of 2 which is the maximum frequency in the array. So the number of elements in the array with maximum frequency is 4. ``` **Example 2:** ``` **Input:** nums = [1,2,3,4,5] **Output:** 5 **Explanation:** All elements of the array have a frequency of 1 which is the maximum. So the number of elements in the array with maximum frequency is 5. ``` **Constraints:** `1 <= nums.length <= 100` `1 <= nums[i] <= 100`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [1,2,2,3,1,4]",12            "output": "4 "13        },14        {15            "label": "Example 2",16            "input": "nums = [1,2,3,4,5]",17            "output": "5 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                80,24                65,25                89,26                19,27                79,28                52,29                54,30                72,31                15,32                35,33                8534            ],35            "output": 1136        },37        {38            "input": [39                56,40                59,41                77,42                53,43                13,44                70,45                4,46                43,47                1,48                40,49                72,50                93,51                32,52                42,53                54,54                49,55                45,56                47,57                25,58                99,59                67,60                81,61                90,62                20,63                16,64                20,65                14,66                21,67                46,68                49,69                67,70                59,71                75,72                33,73                96,74                54,75                48,76                30,77                1,78                3,79                46,80                17,81                96,82                64,83                36,84                18,85                80,86                15,87                18,88                55,89                76,90                83,91                60,92                64,93                45,94                16,95                72,96                10,97                32,98                53,99                16,100                31,101                2,102                81,103                28,104                33,105                1,106                72,107                60,108                49,109                98,110                67,111                82,112                1,113                41,114                44,115                60,116                59117            ],118            "output": 4119        },120        {121            "input": [122                47,123                33,124                54,125                38,126                41,127                9,128                90,129                84,130                80,131                66132            ],133            "output": 10134        },135        {136            "input": [137                95,138                49,139                59,140                77,141                35142            ],143            "output": 5144        },145        {146            "input": [147                5,148                85,149                82,150                86,151                45,152                66,153                82,154                28155            ],156            "output": 2157        }158    ],159    "haskell_template": "maxFrequencyElements :: [Int] -> Int\nmaxFrequencyElements nums ",160    "ocaml_template": "let maxFrequencyElements (nums: int list) : int =  ",161    "scala_template": "def maxFrequencyElements(nums: List[Int]): Int = { \n    \n}",162    "java_template": "class Solution {\n    public int maxFrequencyElements(int[] nums) {\n        \n    }\n}",163    "python_template": "class Solution(object):\n    def maxFrequencyElements(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: int\n        \"\"\"\n        "164}