CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes564downloads
meta.json445 linesDownload Raw Back to minimum_number_game
1{2    "id": 3226,3    "name": "minimum_number_game",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/minimum-number-game/",6    "date": "2023-12-17 00:00:00",7    "task_description": "You are given a **0-indexed** integer array `nums` of **even** length and there is also an empty array `arr`. Alice and Bob decided to play a game where in every round Alice and Bob will do one move. The rules of the game are as follows: Every round, first Alice will remove the **minimum** element from `nums`, and then Bob does the same. Now, first Bob will append the removed element in the array `arr`, and then Alice does the same. The game continues until `nums` becomes empty. Return _the resulting array _`arr`. **Example 1:** ``` **Input:** nums = [5,4,2,3] **Output:** [3,2,5,4] **Explanation:** In round one, first Alice removes 2 and then Bob removes 3. Then in arr firstly Bob appends 3 and then Alice appends 2. So arr = [3,2]. At the begining of round two, nums = [5,4]. Now, first Alice removes 4 and then Bob removes 5. Then both append in arr which becomes [3,2,5,4]. ``` **Example 2:** ``` **Input:** nums = [2,5] **Output:** [5,2] **Explanation:** In round one, first Alice removes 2 and then Bob removes 5. Then in arr firstly Bob appends and then Alice appends. So arr = [5,2]. ``` **Constraints:** `2 <= nums.length <= 100` `1 <= nums[i] <= 100` `nums.length % 2 == 0`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [5,4,2,3]",12            "output": "[3,2,5,4] "13        },14        {15            "label": "Example 2",16            "input": "nums = [2,5]",17            "output": "[5,2] "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                23,24                20,25                50,26                50,27                96,28                5929            ],30            "output": [31                23,32                20,33                50,34                50,35                96,36                5937            ]38        },39        {40            "input": [41                1,42                1,43                2,44                2,45                8,46                5,47                12,48                9,49                15,50                13,51                15,52                15,53                19,54                18,55                22,56                22,57                25,58                24,59                28,60                28,61                31,62                29,63                32,64                31,65                43,66                40,67                46,68                44,69                51,70                48,71                54,72                51,73                63,74                58,75                65,76                64,77                65,78                65,79                68,80                68,81                75,82                72,83                78,84                76,85                79,86                79,87                82,88                80,89                86,90                84,91                91,92                90,93                93,94                91,95                94,96                94,97                97,98                95,99                98,100                97101            ],102            "output": [103                1,104                1,105                2,106                2,107                8,108                5,109                12,110                9,111                15,112                13,113                15,114                15,115                19,116                18,117                22,118                22,119                25,120                24,121                28,122                28,123                31,124                29,125                32,126                31,127                43,128                40,129                46,130                44,131                51,132                48,133                54,134                51,135                63,136                58,137                65,138                64,139                65,140                65,141                68,142                68,143                75,144                72,145                78,146                76,147                79,148                79,149                82,150                80,151                86,152                84,153                91,154                90,155                93,156                91,157                94,158                94,159                97,160                95,161                98,162                97163            ]164        },165        {166            "input": [167                2,168                1,169                10,170                5,171                11,172                11,173                22,174                13,175                29,176                28,177                43,178                29,179                47,180                46,181                55,182                51,183                59,184                59,185                64,186                62,187                72,188                66,189                73,190                72,191                75,192                74,193                85,194                81,195                86,196                86,197                91,198                91,199                94,200                91201            ],202            "output": [203                2,204                1,205                10,206                5,207                11,208                11,209                22,210                13,211                29,212                28,213                43,214                29,215                47,216                46,217                55,218                51,219                59,220                59,221                64,222                62,223                72,224                66,225                73,226                72,227                75,228                74,229                85,230                81,231                86,232                86,233                91,234                91,235                94,236                91237            ]238        },239        {240            "input": [241                3,242                1,243                3,244                3,245                11,246                10,247                12,248                12,249                15,250                14,251                25,252                17,253                31,254                27,255                34,256                33,257                37,258                36,259                41,260                40,261                44,262                42,263                47,264                44,265                49,266                48,267                50,268                49,269                50,270                50,271                52,272                52,273                58,274                57,275                60,276                58,277                67,278                65,279                68,280                67,281                69,282                69,283                81,284                78,285                84,286                83,287                93,288                90,289                94,290                94291            ],292            "output": [293                3,294                1,295                3,296                3,297                11,298                10,299                12,300                12,301                15,302                14,303                25,304                17,305                31,306                27,307                34,308                33,309                37,310                36,311                41,312                40,313                44,314                42,315                47,316                44,317                49,318                48,319                50,320                49,321                50,322                50,323                52,324                52,325                58,326                57,327                60,328                58,329                67,330                65,331                68,332                67,333                69,334                69,335                81,336                78,337                84,338                83,339                93,340                90,341                94,342                94343            ]344        },345        {346            "input": [347                7,348                6,349                16,350                15,351                20,352                19,353                24,354                21,355                26,356                25,357                27,358                26,359                30,360                27,361                39,362                33,363                44,364                41,365                46,366                46,367                52,368                49,369                55,370                52,371                58,372                58,373                61,374                59,375                61,376                61,377                66,378                66,379                68,380                68,381                69,382                69,383                80,384                78,385                85,386                83,387                90,388                89,389                97,390                90391            ],392            "output": [393                7,394                6,395                16,396                15,397                20,398                19,399                24,400                21,401                26,402                25,403                27,404                26,405                30,406                27,407                39,408                33,409                44,410                41,411                46,412                46,413                52,414                49,415                55,416                52,417                58,418                58,419                61,420                59,421                61,422                61,423                66,424                66,425                68,426                68,427                69,428                69,429                80,430                78,431                85,432                83,433                90,434                89,435                97,436                90437            ]438        }439    ],440    "haskell_template": "numberGame :: [Int] -> [Int]\nnumberGame nums ",441    "ocaml_template": "let numberGame (nums: int list) : int list =  ",442    "scala_template": "def numberGame(nums: List[Int]): List[Int] = { \n    \n}",443    "java_template": "class Solution {\n    public int[] numberGame(int[] nums) {\n        \n    }\n}",444    "python_template": "class Solution(object):\n    def numberGame(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: List[int]\n        \"\"\"\n        "445}