CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

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

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