CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes572downloads
1{2    "id": 2269,3    "name": "count_elements_with_strictly_smaller_and_greater_elements",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/count-elements-with-strictly-smaller-and-greater-elements/",6    "date": "1642291200000",7    "task_description": "Given an integer array `nums`, return _the number of elements that have **both** a strictly smaller and a strictly greater element appear in _`nums`. **Example 1:** ``` **Input:** nums = [11,7,2,15] **Output:** 2 **Explanation:** The element 7 has the element 2 strictly smaller than it and the element 11 strictly greater than it. Element 11 has element 7 strictly smaller than it and element 15 strictly greater than it. In total there are 2 elements having both a strictly smaller and a strictly greater element appear in `nums`. ``` **Example 2:** ``` **Input:** nums = [-3,3,3,90] **Output:** 2 **Explanation:** The element 3 has the element -3 strictly smaller than it and the element 90 strictly greater than it. Since there are two elements with the value 3, in total there are 2 elements having both a strictly smaller and a strictly greater element appear in `nums`. ``` **Constraints:** `1 <= nums.length <= 100` `-105 <= nums[i] <= 105`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [11,7,2,15]",12            "output": "2 "13        },14        {15            "label": "Example 2",16            "input": "nums = [-3,3,3,90]",17            "output": "2 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                -16495,24                -75944,25                -48832,26                -43211,27                55199,28                -26971,29                56250,30                36003,31                38879,32                -74791,33                -94268,34                58607,35                16273,36                55472,37                -56805,38                -95926,39                -11111,40                -52242,41                -88431,42                64772,43                21060,44                69992,45                71683,46                -24063,47                -90117,48                -75520,49                -69648,50                -42323,51                -73811,52                -62509,53                98238,54                24283,55                84870,56                6862,57                17398,58                -7013,59                -75609,60                45147,61                31890,62                -41994,63                -48075,64                -74993,65                5754,66                -97319,67                -68545,68                -2582,69                -70915,70                -1302471            ],72            "output": 4673        },74        {75            "input": [76                -34148,77                -80144,78                -61499,79                -62139,80                14674,81                -47086,82                53129,83                -98222,84                -5593,85                96126,86                -6106,87                -31157,88                14553,89                66678,90                53695,91                -66934,92                -93114,93                2282,94                37537,95                27855,96                -50787,97                28391,98                2824,99                -19927,100                -82417,101                64055102            ],103            "output": 24104        },105        {106            "input": [107                7816,108                -6842,109                55004,110                66778,111                21760,112                67754,113                -68695,114                4029,115                85692,116                -26164,117                -51081,118                -37400,119                70153,120                44023,121                -85582,122                46585,123                45518,124                -89498,125                54462,126                -49101,127                -38142,128                91991,129                70902,130                -49023,131                19466,132                48518,133                -52024,134                -4135,135                -81818,136                -90783,137                -40324,138                58347,139                32836,140                -86955,141                -29636,142                58207,143                88747,144                -10281,145                -64003,146                4693,147                59399,148                -72581,149                -19096,150                -35157,151                -86889,152                92053,153                -83011,154                66574,155                -60195,156                78251,157                74166,158                65572,159                -90860,160                -83983,161                -47581,162                82314,163                84168,164                27979,165                54298166            ],167            "output": 57168        },169        {170            "input": [171                -48537,172                53316,173                -66824,174                40706,175                92698,176                -42067,177                42682,178                34581,179                -203,180                51535,181                7930,182                -28762,183                -1467,184                -39118,185                49859,186                32336,187                -79051,188                -49948,189                -41809,190                -77147,191                58814,192                -80870,193                68523,194                -30928,195                11251,196                -48457,197                -13212,198                -37267,199                33004,200                -33527,201                -89673,202                -57233,203                57476,204                -75371,205                1157,206                38546,207                -86629,208                86751,209                63665,210                -85855,211                21316,212                52287,213                -6622,214                -64680,215                60383,216                63174,217                84645,218                -25852,219                -90714,220                32397,221                91472,222                2339,223                -95428,224                53076,225                99849,226                -94288,227                -73452,228                -54576,229                -75936,230                -88722,231                32950,232                75320,233                -20035,234                82027,235                -67810,236                15962,237                -84434238            ],239            "output": 65240        },241        {242            "input": [243                98533,244                -19572,245                -40152,246                -32039,247                67214,248                -85514,249                86953,250                -17303,251                93645,252                73580,253                -86199,254                -24942,255                -84798,256                47412,257                18474,258                -93902,259                78511,260                -31376,261                23698,262                10761,263                -77229,264                72163,265                -34755,266                -99316,267                96974,268                15835,269                -41249,270                -33841,271                80393,272                31,273                99101,274                -85898,275                -82580,276                -29534,277                68439,278                94500,279                17085,280                89537,281                22883,282                -82115,283                3011,284                -38752,285                30086,286                -73079,287                -67731,288                -16394,289                -9532,290                -1368,291                66174,292                29887,293                804,294                53777,295                -82793,296                -46938,297                -87992,298                -14377,299                325,300                87291,301                -43316,302                -75402,303                -18739,304                -56660,305                15238306            ],307            "output": 61308        },309        {310            "input": [311                -49906,312                -11166,313                -92889,314                -89942,315                -69573,316                73074,317                -11318,318                12408,319                -48049,320                2102,321                -80384,322                24085,323                -34466324            ],325            "output": 11326        },327        {328            "input": [329                25003,330                -58597,331                86707,332                10511,333                52986,334                -90786,335                46592,336                6930,337                74278,338                -1921,339                41341,340                -36393,341                5382,342                13158,343                48178,344                40128,345                19216,346                82928,347                11877,348                -68250,349                40534,350                54778,351                -2681352            ],353            "output": 21354        },355        {356            "input": [357                77494,358                10930,359                -81776,360                94536361            ],362            "output": 2363        },364        {365            "input": [366                89635,367                70201,368                -98214,369                11501,370                -65877,371                -61081,372                -35998,373                88563,374                -39201,375                80846,376                87557,377                48304,378                -76388,379                -52634,380                -67564,381                -20165,382                -3851,383                -39548,384                7917,385                29521,386                68889,387                65510,388                40528,389                29110,390                -66321,391                -14748,392                75517,393                26511,394                1480,395                -34379,396                -90498,397                -43208,398                -80866,399                -12208,400                9564,401                -65219,402                94535,403                -16207,404                -89167,405                -68142,406                -93602,407                -95636,408                55989,409                58049,410                -29142,411                40942,412                61806,413                -63773,414                -43295,415                98034,416                15318,417                -86722,418                -40118,419                27933,420                93888,421                -74294,422                96461,423                40930,424                35035,425                5813,426                63814427            ],428            "output": 59429        },430        {431            "input": [432                85320,433                42491,434                11672,435                -87727,436                57694,437                -62771,438                -59807,439                -60242,440                -59011,441                86970,442                -70081,443                -30163,444                27806,445                76170,446                -73914,447                -42096,448                -30305,449                87771,450                -69338,451                40872,452                56745,453                -23856,454                91909,455                24868,456                -65390,457                -55118,458                -234,459                99534,460                50888,461                -39228,462                -85329,463                28056,464                36405,465                19571,466                72186,467                -83292,468                -55181,469                77844,470                -2913,471                -78503,472                9522,473                -37564,474                46232,475                72391,476                -77620,477                23466,478                61458,479                -66037,480                76741,481                -16057,482                -76196,483                26631,484                95124,485                -67797,486                81921,487                12106,488                38601,489                -58596,490                65704,491                70463492            ],493            "output": 58494        }495    ],496    "haskell_template": "countElements :: [Int] -> Int\ncountElements nums ",497    "ocaml_template": "let countElements (nums: int list) : int =  ",498    "scala_template": "def countElements(nums: List[Int]): Int = { \n    \n}",499    "java_template": "public static int countElements(List<Integer> nums) {\n\n}",500    "python_template": "class Solution(object):\n    def countElements(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: int\n        \"\"\"\n        "501}