FPEvalDataset/LeetCodeProblem
0305
1{2 "id": 3152,3 "name": "maximum_value_of_an_ordered_triplet_ii",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/maximum-value-of-an-ordered-triplet-ii/",6 "date": "2023-09-24 00:00:00",7 "task_description": "You are given a **0-indexed** integer array `nums`. Return _**the maximum value over all triplets of indices**_ `(i, j, k)` _such that_ `i < j < k`_. _If all such triplets have a negative value, return `0`. The **value of a triplet of indices** `(i, j, k)` is equal to `(nums[i] - nums[j]) * nums[k]`. **Example 1:** ``` **Input:** nums = [12,6,1,2,7] **Output:** 77 **Explanation:** The value of the triplet (0, 2, 4) is (nums[0] - nums[2]) * nums[4] = 77. It can be shown that there are no ordered triplets of indices with a value greater than 77. ``` **Example 2:** ``` **Input:** nums = [1,10,3,4,19] **Output:** 133 **Explanation:** The value of the triplet (1, 2, 4) is (nums[1] - nums[2]) * nums[4] = 133. It can be shown that there are no ordered triplets of indices with a value greater than 133. ``` **Example 3:** ``` **Input:** nums = [1,2,3] **Output:** 0 **Explanation:** The only ordered triplet of indices (0, 1, 2) has a negative value of (nums[0] - nums[1]) * nums[2] = -3. Hence, the answer would be 0. ``` **Constraints:** `3 <= nums.length <= 105` `1 <= nums[i] <= 106`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [12,6,1,2,7]",12 "output": "77 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,10,3,4,19]",17 "output": "133 "18 },19 {20 "label": "Example 3",21 "input": "nums = [1,2,3]",22 "output": "0 "23 }24 ],25 "private_test_cases": [26 {27 "input": [28 966320,29 963984,30 818468,31 112209,32 696634,33 69187,34 796512,35 247773,36 610650,37 803596,38 324937,39 397220,40 919550,41 547230,42 125225,43 402836,44 834617,45 431452,46 646306,47 839596,48 149520,49 265968,50 679451,51 91983,52 930851,53 213028,54 670157,55 437724,56 774048,57 523164,58 184938,59 560889,60 903755,61 570228,62 12090,63 940898,64 632204,65 275521,66 880170,67 907510,68 261854,69 936834,70 798655,71 600328,72 778351,73 73736,74 970022,75 419730,76 538931,77 637621,78 993180,79 359205,80 286791,81 853648,82 477344,83 931064,84 72327,85 619049,86 641403,87 724041,88 178386,89 645418,90 143251,91 811737,92 818523,93 187070,94 820292,95 249952,96 21797,97 263803,98 194760,99 478084,100 187507,101 190858,102 353923,103 344575,104 954576,105 557508,106 291137,107 901856,108 100957,109 303175,110 670043,111 692370,112 11688,113 317345,114 851516,115 762556,116 173920,117 120292,118 183121,119 694545,120 252121,121 82031,122 755903,123 283519,124 582491,125 830009,126 771630,127 840679,128 447027,129 177478,130 36238,131 785745,132 201018,133 546424,134 206187,135 778738,136 533551,137 852324,138 243898,139 994243,140 118204,141 823170,142 883866,143 409260,144 978327,145 291019,146 589443,147 284987,148 52477,149 875219,150 796394,151 794826,152 579849,153 860327,154 812157,155 28588,156 691161,157 62385,158 350508,159 799645,160 988677,161 837205,162 323599,163 566470,164 529846,165 276723,166 4679,167 21905,168 720160,169 362402,170 943366,171 278852,172 99284,173 601535,174 676734,175 214814,176 109663,177 317005,178 138408,179 722362,180 503041,181 345876,182 659858,183 951205,184 216537,185 406066,186 289463,187 936191,188 519391,189 600912,190 680587,191 340681,192 891790,193 603753,194 618873,195 388561,196 979780,197 348883,198 443572,199 776404,200 270333,201 340789,202 852972,203 27269,204 445735,205 122285,206 752849,207 740138,208 405981,209 875675,210 561304,211 564552,212 92268,213 149839,214 974665,215 386644,216 557,217 186439,218 843550,219 285531,220 150250,221 380045,222 285488,223 354821,224 519679,225 759312,226 340967,227 191680,228 658728,229 429346,230 859202,231 266766,232 437966,233 161307,234 732698,235 532572,236 832885,237 471464,238 472241,239 425323,240 379645,241 561658,242 41712,243 864995,244 206841,245 941606,246 2265,247 621292,248 690365,249 162015,250 522200,251 682368,252 829154,253 516652,254 941837,255 102994,256 900965,257 190416,258 770715,259 314051,260 676692,261 963823,262 388975,263 328253,264 745480,265 978546,266 894875,267 982750,268 745303,269 136959,270 694794,271 335495,272 874648,273 594594,274 78691,275 693862,276 470371,277 225428,278 131859,279 530328,280 878845,281 335770,282 832598,283 588487,284 496115,285 200646,286 107575,287 61978,288 58116,289 839033,290 447807,291 264048,292 923541,293 202016,294 357438,295 378735,296 54418,297 272560,298 16215,299 476665,300 310425,301 888377,302 442590,303 260048,304 884006,305 62101,306 61142,307 926496,308 94961,309 358123,310 340369,311 778680,312 58974,313 341242,314 119957,315 404487,316 759158,317 922036,318 96556,319 396109,320 436813,321 126206,322 430314,323 984433,324 589305,325 315559,326 102269,327 191221,328 365034,329 160819,330 831703,331 929093,332 563425,333 634456,334 231879,335 831218,336 152486,337 82467,338 915211,339 623718,340 626304,341 990426,342 380426,343 651410,344 507878,345 327339,346 971922,347 280777,348 941567,349 707866,350 357266,351 959838,352 682934,353 2900,354 815467,355 898528,356 211225,357 38516,358 279247,359 247759,360 550445,361 527170,362 640784,363 810104,364 541116,365 965164,366 185450,367 54431,368 501674,369 123590,370 252300,371 425526,372 701479,373 41365,374 208967,375 144150,376 728549,377 348290,378 887443,379 89000,380 962597,381 359344,382 86715,383 466938,384 697066,385 488242,386 979911,387 744456,388 802808,389 403283,390 899797,391 408550,392 808050,393 294244,394 536561,395 767756,396 944738,397 932259,398 613715,399 183939,400 726205,401 901705,402 840785,403 720655,404 815757,405 481376,406 765289,407 537794,408 707438,409 463335,410 665475,411 53799,412 430665,413 230399,414 531733,415 824559,416 121218,417 800469,418 901503,419 68278,420 233114,421 517641,422 339697,423 896456,424 56164,425 745549,426 47880,427 307787,428 799857,429 470706,430 450200,431 444826,432 356297,433 655691,434 97721,435 947535,436 476861,437 487252,438 65595,439 614562,440 638046,441 379036,442 157112,443 773985,444 733290,445 833458,446 752127,447 267297,448 112042,449 779081,450 38958,451 567523,452 267036,453 325723,454 842664,455 54529,456 609886,457 462371,458 763186,459 250329,460 656730,461 824866,462 295664,463 534788,464 881443,465 367556,466 358453,467 732042,468 730930,469 381805,470 921206,471 108144,472 565536,473 349641,474 50882,475 288164,476 406346,477 656918,478 610347,479 916861,480 692768,481 920403,482 119751,483 76833,484 600261,485 878111,486 162020,487 172354,488 237106,489 340063,490 36598,491 767406,492 330816,493 974516,494 5580,495 394553,496 329336,497 479281,498 647625,499 795642,500 544099,501 487397,502 42655,503 765580,504 213579,505 639944,506 75968,507 884446,508 531783,509 840384,510 629336,511 369326,512 418634,513 70416,514 413120,515 258321,516 269100,517 459571,518 263306,519 712246,520 319934,521 690874,522 429132,523 795030,524 541491,525 807515,526 620333,527 715470,528 228513,529 63754,530 345824,531 452779,532 867308,533 79390,534 178958,535 275060,536 782132,537 43327,538 719458,539 157017,540 131607,541 535617,542 612337,543 697068,544 767238,545 802311,546 475371,547 885114,548 172826,549 249553,550 594769,551 780199,552 931452,553 959353,554 776460,555 748175,556 459869,557 668683,558 472568,559 52884,560 280652,561 826563,562 49332,563 651012,564 307466,565 287589,566 549890,567 248524,568 458024,569 912996,570 813472,571 440699,572 45662,573 882560,574 435819,575 157080,576 815153,577 174819,578 753913,579 265678,580 886122,581 114592,582 550603,583 261640,584 182025,585 541971,586 988047,587 939358,588 982677,589 107458,590 262305,591 443351,592 857390,593 217989,594 717014,595 394038,596 192493,597 317957,598 319954,599 695162,600 653388,601 108158,602 778202,603 783130,604 334471,605 269602,606 662683,607 111003,608 893796,609 448924,610 798631,611 887325,612 958473,613 393481,614 650469,615 918744,616 889597,617 563155,618 421289,619 824215,620 678090,621 450096,622 554876,623 954560,624 312147,625 940628,626 336435,627 335434,628 712520,629 593797,630 814388,631 585762,632 298623,633 910370,634 97582,635 632074,636 216384,637 408791,638 709763,639 583375,640 948534,641 348337,642 898784,643 946882,644 133353,645 650656,646 772667,647 874786,648 713317,649 599668,650 623549,651 156095,652 336877,653 519442,654 846728,655 467050,656 843695,657 585313,658 494321,659 684390,660 352153,661 712794,662 577947,663 940301,664 467486,665 550482,666 647089,667 407574,668 602440,669 114888,670 914325,671 964381,672 287590,673 730141,674 135939,675 284204,676 792634,677 286395,678 840675,679 892753,680 157100,681 798654,682 583063,683 519919,684 249154,685 927229,686 505067,687 75146,688 512703,689 855512,690 656911,691 191622,692 871022,693 827772,694 763532,695 461663,696 844159,697 93216,698 95353,699 409047,700 189051,701 111552,702 11665,703 915872,704 761997,705 493963,706 637694,707 491396,708 450956,709 321199,710 476390,711 349501,712 209460,713 375395,714 370056,715 884012,716 313565,717 394165,718 191582,719 794254,720 738886,721 804557,722 450294,723 598384,724 405605,725 712952,726 820740,727 664542,728 668960,729 651729,730 658748,731 975017,732 948915,733 994846,734 267986,735 517150,736 838060,737 990067,738 365991,739 981427,740 676481,741 296463,742 127792,743 821924,744 456801,745 151713,746 772443,747 62658,748 885025,749 772836,750 207221,751 921628,752 773537,753 866569,754 776590,755 183526,756 845033,757 198401,758 748896,759 563747,760 279078,761 959737,762 410088,763 198703,764 302038,765 131998,766 64697,767 607311,768 585097,769 941977,770 346896,771 763660,772 790102,773 894504,774 4477,775 3335,776 605305,777 391486,778 895700,779 464884,780 992859,781 78063,782 696942,783 623475,784 83543,785 705444,786 461384,787 513736,788 309097,789 316736,790 449563,791 718668,792 951599,793 618454,794 983559,795 376898,796 685023,797 195253,798 146517,799 83354,800 113058,801 388111,802 748323,803 935766,804 973780,805 433538,806 214845,807 921740,808 291170,809 352384,810 453870,811 514309,812 156841,813 226545,814 814669,815 882527,816 625409,817 858842,818 366005,819 414469,820 819624,821 900485,822 921381,823 396779,824 759166,825 449792,826 735021,827 704573,828 113258,829 259003,830 221382,831 18699,832 875459,833 813262,834 585764,835 612777,836 619161,837 914679,838 165994,839 248785,840 462163,841 108327,842 803852,843 462481,844 123923,845 582227,846 362623,847 904328,848 954490,849 752443,850 147775,851 970509,852 10146,853 660402,854 344785,855 210055,856 425064,857 382900,858 451651,859 525897,860 569650,861 472421,862 43570,863 765717,864 168151,865 651718,866 202824,867 699711,868 909837,869 969633,870 421376,871 895224,872 595133,873 986258,874 598299,875 203907,876 4887,877 510628,878 890819,879 885912,880 572950,881 695111,882 220504,883 841753,884 13814,885 343562,886 239255,887 729780,888 217801,889 437064,890 245292,891 119035,892 935036,893 800879,894 333935,895 380394,896 386689,897 154571,898 964876,899 783576,900 580569,901 823177,902 137279,903 861565,904 649879,905 55140,906 835728,907 807290,908 457518,909 230637,910 212656,911 481651,912 30324,913 560657,914 709167,915 730937,916 561142,917 45453,918 427578,919 605337,920 293691,921 587783,922 953257,923 151492,924 341215,925 746974,926 431865,927 711222,928 720122,929 761472,930 823692,931 566616,932 640419,933 12479,934 60000,935 660338,936 480301,937 283512,938 421230,939 940339,940 73908,941 302551,942 387163,943 911956,944 907946,945 552659,946 151184,947 177344,948 613029,949 371524,950 445900,951 721024,952 336948,953 62199,954 908656,955 697041,956 487849,957 386355,958 865882,959 847368,960 74512,961 557601,962 790221,963 913549,964 69525,965 48214,966 622978,967 713255,968 702989,969 673268,970 802039,971 786747,972 482947,973 675248,974 461660,975 890076,976 195518,977 159933,978 611665,979 221935,980 498573,981 831496,982 382869,983 260143,984 715327,985 365760,986 727909,987 73051,988 165577,989 95565,990 151013,991 956282,992 616513,993 914285,994 564277,995 241256,996 609250,997 496756,998 35018,999 919555,1000 546722,1001 651702,1002 476908,1003 956498,1004 580313,1005 494864,1006 988859,1007 489731,1008 897084,1009 245820,1010 337974,1011 120512,1012 819668,1013 288108,1014 222106,1015 144809,1016 216706,1017 385198,1018 708684,1019 589088,1020 54096,1021 686597,1022 814995,1023 790204,1024 965922,1025 915615,1026 835778,1027 689021,1028 795961,1029 510526,1030 161574,1031 369069,1032 836553,1033 319451,1034 54642,1035 559429,1036 968209,1037 216326,1038 992743,1039 43765,1040 20627,1041 15768,1042 233713,1043 419464,1044 483887,1045 830521,1046 766399,1047 469271,1048 881823,1049 123046,1050 396361,1051 72334,1052 142017,1053 645238,1054 179780,1055 797760,1056 535985,1057 599137,1058 838051,1059 178881,1060 853760,1061 233392,1062 694168,1063 258102,1064 817610,1065 268905,1066 267117,1067 119626,1068 220822,1069 101765,1070 31256,1071 515222,1072 979300,1073 138542,1074 28384,1075 550761,1076 956814,1077 711109,1078 619153,1079 812083,1080 775933,1081 451462,1082 768497,1083 530897,1084 931351,1085 300858,1086 715321,1087 978494,1088 89660,1089 128356,1090 635118,1091 101109,1092 918469,1093 411063,1094 582399,1095 614475,1096 441311,1097 443115,1098 108932,1099 926595,1100 559046,1101 620890,1102 183871,1103 974009,1104 753627,1105 852630,1106 295213,1107 315467,1108 816413,1109 705348,1110 205705,1111 863364,1112 434108,1113 96361,1114 807594,1115 67222,1116 217473,1117 657180,1118 615203,1119 711739,1120 294522,1121 497667,1122 430508,1123 63541,1124 938242,1125 231788,1126 855072,1127 298995,1128 523518,1129 455687,1130 771134,1131 418395,1132 154428,1133 354980,1134 272546,1135 395762,1136 874371,1137 967218,1138 914163,1139 302755,1140 351481,1141 184693,1142 682553,1143 335980,1144 168584,1145 386545,1146 660096,1147 64055,1148 984320,1149 435856,1150 335881,1151 724427,1152 285885,1153 666709,1154 326509,1155 243826,1156 9726,1157 561908,1158 158724,1159 408795,1160 407237,1161 444412,1162 882868,1163 865240,1164 637144,1165 122313,1166 809269,1167 219020,1168 76387,1169 15219,1170 691283,1171 351427,1172 710555,1173 860828,1174 993870,1175 457582,1176 575715,1177 935077,1178 651672,1179 483667,1180 140043,1181 800086,1182 796436,1183 386844,1184 727651,1185 441711,1186 109564,1187 341705,1188 615806,1189 320235,1190 600734,1191 202283,1192 843344,1193 185843,1194 96902,1195 81166,1196 115532,1197 144407,1198 583365,1199 672685,1200 524211,