CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 3471,3    "name": "minimum_average_of_smallest_and_largest_elements",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/minimum-average-of-smallest-and-largest-elements/",6    "date": "2024-06-16 00:00:00",7    "task_description": "You have an array of floating point numbers `averages` which is initially empty. You are given an array `nums` of `n` integers where `n` is even. You repeat the following procedure `n / 2` times: Remove the **smallest** element, `minElement`, and the **largest** element `maxElement`, from `nums`. Add `(minElement + maxElement) / 2` to `averages`. Return the **minimum** element in `averages`. **Example 1:** **Input:** nums = [7,8,3,4,15,13,4,1] **Output:** 5.5 **Explanation:** step nums averages 0 [7,8,3,4,15,13,4,1] [] 1 [7,8,3,4,13,4] [8] 2 [7,8,4,4] [8,8] 3 [7,4] [8,8,6] 4 [] [8,8,6,5.5] The smallest element of averages, 5.5, is returned. **Example 2:** **Input:** nums = [1,9,8,3,10,5] **Output:** 5.5 **Explanation:** step nums averages 0 [1,9,8,3,10,5] [] 1 [9,8,3,5] [5.5] 2 [8,5] [5.5,6] 3 [] [5.5,6,6.5] **Example 3:** **Input:** nums = [1,2,3,7,8,9] **Output:** 5.0 **Explanation:** step nums averages 0 [1,2,3,7,8,9] [] 1 [2,3,7,8] [5] 2 [3,7] [5,5] 3 [] [5,5,5] **Constraints:** `2 <= n == nums.length <= 50` `n` is even. `1 <= nums[i] <= 50`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [7,8,3,4,15,13,4,1]",12            "output": "5.5 "13        },14        {15            "label": "Example 2",16            "input": "nums = [1,9,8,3,10,5]",17            "output": "5.5 "18        },19        {20            "label": "Example 3",21            "input": "nums = [1,2,3,7,8,9]",22            "output": "5.0 "23        }24    ],25    "private_test_cases": [26        {27            "input": [28                10,29                11,30                15,31                22,32                22,33                2434            ],35            "output": 16.536        },37        {38            "input": [39                1,40                1,41                4,42                5,43                9,44                11,45                11,46                12,47                12,48                13,49                14,50                15,51                18,52                20,53                20,54                21,55                21,56                25,57                31,58                33,59                36,60                37,61                39,62                40,63                44,64                45,65                46,66                48,67                48,68                49,69                50,70                5071            ],72            "output": 21.073        },74        {75            "input": [76                2,77                6,78                6,79                9,80                9,81                16,82                18,83                23,84                26,85                28,86                29,87                31,88                31,89                34,90                36,91                37,92                45,93                4894            ],95            "output": 21.596        },97        {98            "input": [99                1,100                5,101                6,102                7,103                8,104                9,105                10,106                10,107                11,108                15,109                19,110                20,111                20,112                21,113                29,114                30,115                31,116                32,117                33,118                36,119                37,120                39,121                40,122                41,123                46,124                48125            ],126            "output": 20.5127        },128        {129            "input": [130                5,131                5,132                37,133                43,134                43,135                50136            ],137            "output": 24.0138        },139        {140            "input": [141                1,142                2,143                3,144                3,145                3,146                3,147                4,148                6,149                6,150                7,151                7,152                7,153                8,154                11,155                15,156                16,157                20,158                20,159                21,160                22,161                22,162                26,163                30,164                31,165                31,166                36,167                36,168                37,169                37,170                38,171                38,172                39,173                40,174                42,175                42,176                42,177                49,178                49,179                50,180                50181            ],182            "output": 22.0183        },184        {185            "input": [186                1,187                3,188                4,189                4,190                6,191                7,192                8,193                8,194                9,195                9,196                10,197                11,198                11,199                14,200                15,201                16,202                19,203                20,204                21,205                22,206                22,207                23,208                23,209                24,210                24,211                24,212                26,213                27,214                30,215                32,216                33,217                34,218                35,219                36,220                37,221                37,222                38,223                39,224                40,225                41,226                41,227                43,228                44,229                45,230                46,231                48,232                48,233                49234            ],235            "output": 23.5236        },237        {238            "input": [239                1,240                1,241                1,242                2,243                4,244                4,245                6,246                10,247                10,248                12,249                13,250                15,251                16,252                16,253                16,254                17,255                17,256                17,257                18,258                19,259                21,260                23,261                24,262                28,263                28,264                29,265                33,266                36,267                36,268                36,269                36,270                37,271                37,272                38,273                39,274                39,275                40,276                46,277                48,278                49,279                50,280                50281            ],282            "output": 21.5283        },284        {285            "input": [286                4,287                8,288                11,289                15,290                19,291                23,292                31,293                36,294                39,295                41,296                41,297                49298            ],299            "output": 24.5300        },301        {302            "input": [303                1,304                3,305                6,306                6,307                6,308                6,309                9,310                10,311                13,312                16,313                19,314                20,315                24,316                25,317                27,318                27,319                34,320                34,321                36,322                36,323                37,324                38,325                38,326                39,327                39,328                39,329                39,330                41,331                41,332                41,333                42,334                42,335                42,336                45,337                45,338                46,339                47,340                48,341                49,342                49,343                50,344                50345            ],346            "output": 25.5347        }348    ],349    "haskell_template": "minimumAverage :: [Int] -> Float\nminimumAverage nums ",350    "ocaml_template": "let minimumAverage (nums: int list) : float =  ",351    "scala_template": "def minimumAverage(nums: List[Int]): Float = { \n    \n}",352    "java_template": "class Solution {\n    public double minimumAverage(int[] nums) {\n        \n    }\n}",353    "python_template": "class Solution(object):\n    def minimumAverage(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: float\n        \"\"\"\n        "354}