CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes305downloads
1{2    "id": 2312,3    "name": "most_frequent_number_following_key_in_an_array",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/most-frequent-number-following-key-in-an-array/",6    "date": "1645228800000",7    "task_description": "You are given a **0-indexed** integer array `nums`.** **You are also given an integer `key`, which is present in `nums`. For every unique integer `target` in `nums`, **count** the number of times `target` immediately follows an occurrence of `key` in `nums`. In other words, count the number of indices `i` such that: `0 <= i <= nums.length - 2`, `nums[i] == key` and, `nums[i + 1] == target`. Return _the _`target`_ with the **maximum** count_. The test cases will be generated such that the `target` with maximum count is unique. **Example 1:** ``` **Input:** nums = [1,100,200,1,100], key = 1 **Output:** 100 **Explanation:** For target = 100, there are 2 occurrences at indices 1 and 4 which follow an occurrence of key. No other integers follow an occurrence of key, so we return 100. ``` **Example 2:** ``` **Input:** nums = [2,2,2,2,3], key = 2 **Output:** 2 **Explanation:** For target = 2, there are 3 occurrences at indices 1, 2, and 3 which follow an occurrence of key. For target = 3, there is only one occurrence at index 4 which follows an occurrence of key. target = 2 has the maximum number of occurrences following an occurrence of key, so we return 2. ``` **Constraints:** `2 <= nums.length <= 1000` `1 <= nums[i] <= 1000` The test cases will be generated such that the answer is unique.",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [1,100,200,1,100], key = 1",12            "output": "100 "13        },14        {15            "label": "Example 2",16            "input": "nums = [2,2,2,2,3], key = 2",17            "output": "2 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                [24                    349,25                    635,26                    702,27                    959,28                    69,29                    417,30                    835,31                    20,32                    959,33                    357,34                    959,35                    516,36                    785,37                    312,38                    513,39                    294,40                    773,41                    345,42                    816,43                    350,44                    944,45                    299,46                    885,47                    273,48                    959,49                    729,50                    959,51                    530,52                    859,53                    885,54                    552,55                    61,56                    959,57                    677,58                    31,59                    731,60                    959,61                    266,62                    511,63                    424,64                    252,65                    439,66                    227,67                    959,68                    144,69                    69,70                    959,71                    737,72                    736,73                    959,74                    959,75                    281,76                    694,77                    246,78                    39,79                    54,80                    959,81                    937,82                    194,83                    959,84                    906,85                    959,86                    778,87                    983,88                    347,89                    959,90                    330,91                    282,92                    233,93                    28,94                    565,95                    910,96                    183,97                    246,98                    436,99                    944,100                    959,101                    835,102                    959,103                    812,104                    786,105                    897,106                    72,107                    844,108                    959,109                    233,110                    948,111                    959,112                    389,113                    959,114                    937,115                    959,116                    959,117                    959,118                    41,119                    910,120                    139,121                    750,122                    959,123                    882,124                    959,125                    654,126                    885,127                    782,128                    944,129                    763,130                    467,131                    959,132                    128,133                    888,134                    201,135                    417,136                    958,137                    377,138                    959,139                    10,140                    119,141                    900,142                    886,143                    19,144                    405,145                    377,146                    398,147                    959,148                    529,149                    951,150                    185,151                    983,152                    959,153                    788,154                    310,155                    479,156                    773,157                    959,158                    758,159                    972,160                    194,161                    911,162                    959,163                    923,164                    959,165                    638,166                    685,167                    181,168                    118,169                    892,170                    959,171                    959,172                    959,173                    382,174                    302,175                    598,176                    685,177                    185,178                    26,179                    349,180                    523,181                    812,182                    556,183                    959,184                    243,185                    959,186                    834,187                    925,188                    912,189                    799,190                    302,191                    958,192                    959,193                    422,194                    911,195                    959,196                    959,197                    999,198                    959,199                    959,200                    54,201                    684,202                    868,203                    474,204                    474,205                    959,206                    959,207                    808,208                    639,209                    794,210                    959,211                    113,212                    959,213                    26,214                    691,215                    552,216                    959,217                    685,218                    310,219                    195,220                    786,221                    66,222                    812,223                    152,224                    234,225                    209,226                    537,227                    864,228                    120,229                    959,230                    953,231                    668,232                    591,233                    959,234                    811,235                    796,236                    945,237                    385,238                    772,239                    71,240                    959,241                    959,242                    396,243                    959,244                    519,245                    943,246                    960,247                    500,248                    447,249                    216,250                    417,251                    864,252                    836,253                    679,254                    666,255                    803,256                    612,257                    10,258                    959,259                    953,260                    10,261                    771,262                    834,263                    959,264                    120,265                    476,266                    201,267                    519,268                    959,269                    959,270                    691,271                    812,272                    343,273                    868,274                    54,275                    71,276                    164,277                    878,278                    451,279                    959,280                    447,281                    670,282                    782,283                    959,284                    750,285                    836,286                    206,287                    349,288                    227,289                    631,290                    128,291                    959,292                    370,293                    923,294                    921,295                    834,296                    33,297                    272,298                    973,299                    747,300                    439,301                    843,302                    589,303                    310,304                    183,305                    317,306                    444,307                    607,308                    378,309                    267,310                    814,311                    282,312                    945,313                    816,314                    959,315                    786,316                    242,317                    581,318                    346,319                    959,320                    964,321                    954,322                    190,323                    732,324                    498,325                    959,326                    959,327                    363,328                    959,329                    149,330                    352,331                    786,332                    496,333                    695,334                    57,335                    684,336                    3,337                    502,338                    959,339                    797,340                    165,341                    421,342                    702,343                    512,344                    227,345                    329,346                    973,347                    362,348                    630,349                    465,350                    795,351                    502,352                    791,353                    697,354                    308,355                    595,356                    310,357                    492,358                    959,359                    252,360                    63,361                    266,362                    88,363                    959,364                    345,365                    42,366                    153,367                    581,368                    991,369                    899,370                    267,371                    937,372                    272,373                    846,374                    959,375                    352,376                    54,377                    959,378                    538,379                    921,380                    584,381                    2,382                    104,383                    350,384                    206,385                    320,386                    959,387                    933,388                    68,389                    569,390                    485,391                    532,392                    779,393                    591,394                    668,395                    933,396                    975,397                    356,398                    959,399                    282,400                    182,401                    769,402                    305,403                    959,404                    634,405                    228,406                    285,407                    985,408                    31,409                    453,410                    900,411                    485,412                    882,413                    893,414                    153,415                    325,416                    581,417                    696,418                    730,419                    189,420                    209,421                    690,422                    622,423                    183,424                    335,425                    869,426                    310,427                    702,428                    273,429                    404,430                    116,431                    511,432                    339,433                    959,434                    959,435                    197,436                    814,437                    907,438                    959,439                    959,440                    25,441                    546,442                    263,443                    453,444                    344,445                    727,446                    312,447                    720,448                    597,449                    959,450                    959,451                    959,452                    250,453                    217,454                    931,455                    629,456                    21,457                    712,458                    69,459                    678,460                    303,461                    959,462                    788,463                    752,464                    537,465                    959,466                    404,467                    747,468                    58,469                    959,470                    959,471                    959,472                    432,473                    447,474                    448,475                    466,476                    607,477                    933,478                    687,479                    545,480                    536,481                    952,482                    921,483                    474,484                    804,485                    668,486                    179,487                    237,488                    816,489                    857,490                    763,491                    763,492                    431,493                    984,494                    637,495                    920,496                    181,497                    485,498                    311,499                    989,500                    886,501                    797,502                    644,503                    959,504                    330,505                    959,506                    330,507                    959,508                    149,509                    262,510                    906,511                    607,512                    82,513                    7,514                    959,515                    794,516                    13,517                    860,518                    69,519                    349,520                    959,521                    166,522                    357,523                    237,524                    267,525                    584,526                    307,527                    436,528                    959,529                    218,530                    390,531                    726,532                    869,533                    959,534                    959,535                    400,536                    778,537                    349,538                    439,539                    959,540                    898,541                    435,542                    959,543                    610,544                    246,545                    307,546                    959,547                    750,548                    925,549                    640,550                    959,551                    64,552                    200,553                    397,554                    959,555                    245,556                    19,557                    153,558                    959,559                    737,560                    567,561                    322,562                    821,563                    959,564                    365,565                    634,566                    675,567                    761,568                    959,569                    347,570                    959,571                    447,572                    45,573                    897,574                    71,575                    334,576                    234,577                    216,578                    959,579                    959,580                    959,581                    672,582                    860,583                    228,584                    959,585                    640,586                    545,587                    67,588                    362,589                    62,590                    69,591                    959,592                    618,593                    109,594                    200,595                    758,596                    959,597                    388,598                    959,599                    942,600                    389,601                    959602                ],603                959604            ],605            "output": 959606        },607        {608            "input": [609                [610                    488,611                    233,612                    891,613                    235,614                    317,615                    35,616                    814,617                    35,618                    973,619                    376,620                    55,621                    336,622                    899,623                    937,624                    236,625                    764,626                    680,627                    411,628                    489,629                    411,630                    370,631                    411,632                    411,633                    132,634                    202,635                    132,636                    862,637                    440,638                    555,639                    433,640                    411,641                    899,642                    760,643                    732,644                    245,645                    397,646                    483,647                    982,648                    894,649                    35,650                    149,651                    734,652                    467,653                    166,654                    130,655                    990,656                    411,657                    411,658                    459,659                    61,660                    855,661                    364,662                    513,663                    945,664                    70,665                    920,666                    83,667                    317,668                    894,669                    764,670                    248,671                    236,672                    766,673                    215,674                    411,675                    411,676                    761,677                    411,678                    820,679                    986,680                    288,681                    672,682                    920,683                    238,684                    513,685                    411,686                    411,687                    826,688                    317,689                    625,690                    223,691                    712,692                    928,693                    444,694                    275,695                    343,696                    411,697                    411,698                    153,699                    480,700                    71,701                    440,702                    635,703                    637,704                    676,705                    243,706                    411,707                    635,708                    411,709                    411,710                    273,711                    490,712                    411,713                    411,714                    670,715                    978,716                    370,717                    702,718                    815,719                    811,720                    411,721                    820,722                    732,723                    899,724                    406,725                    411,726                    340,727                    317,728                    535,729                    732,730                    2,731                    518,732                    238,733                    672,734                    95,735                    411,736                    411,737                    478,738                    248,739                    894,740                    755,741                    659,742                    95,743                    467,744                    411,745                    411,746                    192,747                    625,748                    411,749                    680,750                    36,751                    411,752                    411,753                    518,754                    344,755                    340,756                    470,757                    227,758                    236,759                    364760                ],761                411762            ],763            "output": 411764        },765        {766            "input": [767                [768                    903,769                    146,770                    940,771                    924,772                    328,773                    312,774                    924,775                    605,776                    936,777                    485,778                    570,779                    333,780                    580,781                    940,782                    954,783                    924,784                    360,785                    260,786                    520,787                    621,788                    25,789                    924,790                    924,791                    853,792                    766,793                    526,794                    965,795                    223,796                    514,797                    201,798                    936,799                    275,800                    514,801                    440,802                    985,803                    440,804                    924,805                    520,806                    924,807                    597,808                    924,809                    878,810                    791,811                    924,812                    924,813                    584,814                    143,815                    556,816                    386,817                    924,818                    924,819                    973,820                    360,821                    302,822                    122,823                    830,824                    644,825                    924,826                    146,827                    582,828                    973,829                    21,830                    582,831                    883,832                    70,833                    699,834                    924,835                    81,836                    380,837                    475,838                    936,839                    326,840                    565,841                    623,842                    237,843                    211,844                    924,845                    530,846                    924,847                    146,848                    487,849                    122,850                    789,851                    992,852                    924,853                    839,854                    25,855                    271,856                    924,857                    924,858                    924,859                    193,860                    81,861                    76,862                    558,863                    663,864                    791,865                    843,866                    666,867                    271,868                    212,869                    264,870                    328,871                    62,872                    61,873                    509,874                    758,875                    924,876                    174,877                    924,878                    958,879                    924,880                    570,881                    789,882                    94,883                    173,884                    924,885                    211,886                    924,887                    924,888                    55,889                    349,890                    653,891                    105,892                    580,893                    691,894                    924,895                    924,896                    924,897                    924,898                    883,899                    952,900                    243,901                    924,902                    924,903                    108,904                    204,905                    671,906                    66,907                    693,908                    924,909                    215,910                    743,911                    82,912                    924,913                    21,914                    924,915                    924,916                    982,917                    122,918                    62,919                    924,920                    843,921                    679,922                    924,923                    176,924                    924,925                    232,926                    881,927                    924,928                    836,929                    936,930                    884,931                    924,932                    891,933                    97,934                    924,935                    952,936                    924,937                    5,938                    699,939                    81,940                    911,941                    554,942                    37,943                    901,944                    319,945                    368,946                    509,947                    417,948                    502,949                    976,950                    979,951                    195,952                    934,953                    122,954                    958,955                    924,956                    924,957                    651,958                    62,959                    965,960                    212,961                    451,962                    913,963                    17,964                    924,965                    129,966                    359,967                    446,968                    924,969                    480,970                    924,971                    663,972                    924,973                    12,974                    924,975                    149,976                    924,977                    758,978                    924,979                    534,980                    924,981                    406,982                    910,983                    924,984                    297,985                    924,986                    173,987                    756,988                    276,989                    986,990                    399,991                    319,992                    891,993                    170,994                    924,995                    513,996                    972,997                    681,998                    174,999                    76,1000                    932,1001                    586,1002                    215,1003                    994,1004                    924,1005                    55,1006                    924,1007                    962,1008                    763,1009                    924,1010                    328,1011                    421,1012                    417,1013                    924,1014                    758,1015                    688,1016                    7,1017                    246,1018                    237,1019                    545,1020                    485,1021                    227,1022                    129,1023                    924,1024                    982,1025                    881,1026                    924,1027                    588,1028                    256,1029                    924,1030                    48,1031                    256,1032                    912,1033                    924,1034                    782,1035                    204,1036                    258,1037                    290,1038                    544,1039                    424,1040                    924,1041                    903,1042                    457,1043                    837,1044                    62,1045                    605,1046                    442,1047                    924,1048                    924,1049                    252,1050                    542,1051                    924,1052                    994,1053                    668,1054                    811,1055                    924,1056                    295,1057                    149,1058                    992,1059                    460,1060                    335,1061                    69,1062                    418,1063                    959,1064                    924,1065                    924,1066                    996,1067                    157,1068                    264,1069                    473,1070                    454,1071                    171,1072                    174,1073                    924,1074                    905,1075                    837,1076                    430,1077                    168,1078                    570,1079                    94,1080                    270,1081                    891,1082                    288,1083                    380,1084                    905,1085                    326,1086                    924,1087                    475,1088                    903,1089                    924,1090                    153,1091                    758,1092                    772,1093                    264,1094                    900,1095                    449,1096                    924,1097                    311,1098                    653,1099                    791,1100                    193,1101                    599,1102                    870,1103                    924,1104                    460,1105                    561,1106                    924,1107                    924,1108                    44,1109                    76,1110                    924,1111                    924,1112                    786,1113                    227,1114                    157,1115                    745,1116                    924,1117                    290,1118                    979,1119                    759,1120                    691,1121                    97,1122                    276,1123                    985,1124                    339,1125                    934,1126                    105,1127                    453,1128                    924,1129                    279,1130                    982,1131                    924,1132                    451,1133                    143,1134                    7,1135                    5581136                ],1137                9241138            ],1139            "output": 9241140        },1141        {1142            "input": [1143                [1144                    783,1145                    593,1146                    490,1147                    102,1148                    758,1149                    224,1150                    947,1151                    855,1152                    224,1153                    134,1154                    17,1155                    446,1156                    994,1157                    224,1158                    955,1159                    368,1160                    611,1161                    866,1162                    329,1163                    611,1164                    228,1165                    947,1166                    804,1167                    806,1168                    258,1169                    362,1170                    224,1171                    44,1172                    615,1173                    139,1174                    224,1175                    224,1176                    960,1177                    558,1178                    699,1179                    942,1180                    674,1181                    627,1182                    584,1183                    699,1184                    224,1185                    81,1186                    817,1187                    656,1188                    963,1189                    126,1190                    180,1191                    224,1192                    224,1193                    182,1194                    906,1195                    865,1196                    193,1197                    875,1198                    137,1199                    987,1200                    19,

Showing the first 1,200 of 4907 lines. Download the file for the rest.