FPEvalDataset/LeetCodeProblem
0305
1{2 "id": 3114,3 "name": "beautiful_towers_i",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/beautiful-towers-i/",6 "date": "2023-09-17 00:00:00",7 "task_description": "You are given an array `heights` of `n` integers representing the number of bricks in `n` consecutive towers. Your task is to remove some bricks to form a **mountain-shaped** tower arrangement. In this arrangement, the tower heights are non-decreasing, reaching a maximum peak value with one or multiple consecutive towers and then non-increasing. Return the **maximum possible sum** of heights of a mountain-shaped tower arrangement. **Example 1:** **Input:** heights = [5,3,4,1,1] **Output:** 13 **Explanation:** We remove some bricks to make `heights = [5,3,3,1,1]`, the peak is at index 0. **Example 2:** **Input:** heights = [6,5,3,9,2,7] **Output:** 22 **Explanation:** We remove some bricks to make `heights = [3,3,3,9,2,2]`, the peak is at index 3. **Example 3:** **Input:** heights = [3,2,5,5,2,3] **Output:** 18 **Explanation:** We remove some bricks to make `heights = [2,2,5,5,2,2]`, the peak is at index 2 or 3. **Constraints:** `1 <= n == heights.length <= 103` `1 <= heights[i] <= 109`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "heights = [5,3,4,1,1]",12 "output": "13 "13 },14 {15 "label": "Example 2",16 "input": "heights = [6,5,3,9,2,7]",17 "output": "22 "18 },19 {20 "label": "Example 3",21 "input": "heights = [3,2,5,5,2,3]",22 "output": "18 "23 }24 ],25 "private_test_cases": [26 {27 "input": [28 461095276,29 386639795,30 873859621,31 892139800,32 82516304,33 785970576,34 553100365,35 677118346,36 850406943,37 598758632,38 637390625,39 974451679,40 319236936,41 312383614,42 59877712,43 773224528,44 753820008,45 319787930,46 264076871,47 348733454,48 654886345,49 225449408,50 895039995,51 907127873,52 62848268,53 348609545,54 810191280,55 598381971,56 566981259,57 831172922,58 629628391,59 702582341,60 733614337,61 416039432,62 398836464,63 404940226,64 3470894,65 580849934,66 776304548,67 542638485,68 196250913,69 876391110,70 241686483,71 400996037,72 578773496,73 150667439,74 811461760,75 350606183,76 882289231,77 255297066,78 39806978,79 358764343,80 810199897,81 64759314,82 140000321,83 625450396,84 686288032,85 686161871,86 83161870,87 94858363,88 233833592,89 499323855,90 992994771,91 597734416,92 206271624,93 368103649,94 24046666,95 120733110,96 388984908,97 445911553,98 459177933,99 791680055,100 83734582,101 688837531,102 908021794,103 411312939,104 877927717,105 544862368,106 707377197,107 834962716,108 149821711,109 945898435,110 777370970,111 954712241,112 634655483,113 787323351,114 714271241,115 981833176,116 679967775,117 400126079,118 254451367,119 196517991,120 348792002,121 531858352,122 719062368,123 431990640,124 519637454,125 491165006,126 9058816,127 642190752,128 108698992,129 696881776,130 611943276,131 735912326,132 513669965,133 560225773,134 81698284,135 671564736,136 888253775,137 240304203,138 342300216,139 84108757,140 451038736,141 21950892,142 538584903,143 709795658,144 579033963,145 807181554,146 831429179,147 949250084,148 303874746,149 827312083,150 809040931,151 93472747,152 480647222,153 982274636,154 704863957,155 545039611,156 466842571,157 451567304,158 442498795,159 902079568,160 322400185,161 139877080,162 396515305,163 643537107,164 256936739,165 716331581,166 452575423,167 354361018,168 747197160,169 254214553,170 199994355,171 264500185,172 448310322,173 112146618,174 47811962,175 415761742,176 982241461,177 373161582,178 376761708,179 169282385,180 805438683,181 698746189,182 475374735,183 7737254,184 610476409,185 750043086,186 205149594,187 824138373,188 106479320,189 855761208,190 347130241,191 614201013,192 860686165,193 581305605,194 901324873,195 833425680,196 243687643,197 111303573,198 15280706,199 480805256,200 362315486,201 476190492,202 918418275,203 780343460,204 583579962,205 105733612,206 291524091,207 570946298,208 175973598,209 942892574,210 637444119,211 101344912,212 523257121,213 484292781,214 705948330,215 504269027,216 965369659,217 12776539,218 572047448,219 778031372,220 931748065,221 143517938,222 440680755,223 697015205,224 567393516,225 310088668,226 576855888,227 885400659,228 35431032,229 423463286,230 376743742,231 120990657,232 386460453,233 541143942,234 116415718,235 723467338,236 276814686,237 876195228,238 196860368,239 939018117,240 426354321,241 639129227,242 280872679,243 495394011,244 272069484,245 391877682,246 387758536,247 97430330,248 120011202,249 392541888,250 479436521,251 700890141,252 92394400,253 661692013,254 482125907,255 420226798,256 346736899,257 913845156,258 974720679,259 476675766,260 222080816,261 529570088,262 630971646,263 138650185,264 214818888,265 374188846,266 277131287,267 821091731,268 414340231,269 785181908,270 667620487,271 427405473,272 503939995,273 534799677,274 905116716,275 988838919,276 772171744,277 721250159,278 12313847,279 426426130,280 134742987,281 444004691,282 524280082,283 839125586,284 980378778,285 652785683,286 72763682,287 319046202,288 891261574,289 62344712,290 6449656,291 830222229,292 712440255,293 965318053,294 917757700,295 15049006,296 440359516,297 906649023,298 493578105,299 306794447,300 818492015,301 65408026,302 294810842,303 454338704,304 936078134,305 393347901,306 807894063,307 926360057,308 858900653,309 456587484,310 737367357,311 444795246,312 551855388,313 193044400,314 192139016,315 493705408,316 716745734,317 943709274,318 945258189,319 206568536,320 786500696,321 865972597,322 627977415,323 226173117,324 743619674,325 297311139,326 743914914,327 719001765,328 378329821,329 896922515,330 372439157,331 991804379,332 993912045,333 538147267,334 843222218,335 165814768,336 367995916,337 632223098,338 225447699,339 110531119,340 273223118,341 853526600,342 453220994,343 944451714,344 835460216,345 388709121,346 653513401,347 608948501,348 789372890,349 637479025,350 847533840,351 550365224,352 31460159,353 121309553,354 726082875,355 398853963,356 919501890,357 929583234,358 86186536,359 222825606,360 572316333,361 762412144,362 373828084,363 377715356,364 357920551,365 107734292,366 722401541,367 648765037,368 843011089,369 871690143,370 833184665,371 618447338,372 950453002,373 618394744,374 273096456,375 528536506,376 368596818,377 672389838,378 427850541,379 197929941,380 596041987,381 917796372,382 202672856,383 553232360,384 456687629,385 173166875,386 430719354,387 345527883,388 856019642,389 103768759,390 500914629,391 813073321,392 45959012,393 981168755,394 966719300,395 685841525,396 976479663,397 496717948,398 434198947,399 852580769,400 259014796,401 585434867,402 670196688,403 363028211,404 444430262,405 475356575,406 154896759,407 185410352,408 507727918,409 846049566,410 26924850,411 830925567,412 857098717,413 545592455,414 292925684,415 391938446,416 534704878,417 839820354,418 702897464,419 976376547,420 101996688,421 464274791,422 773577807,423 698460121,424 806800162,425 932674647,426 590402864,427 837572015,428 667380110,429 674554973,430 269085208,431 845961128,432 268011421,433 935918127,434 131095551,435 606497761,436 947821559,437 635142377,438 78432792,439 105933739,440 436184938,441 993006363,442 660772685,443 190424187,444 593506323,445 135528488,446 247006536,447 598258484,448 14407842,449 798725043,450 177496387,451 952834982452 ],453 "output": 17158105543454 },455 {456 "input": [457 907280058,458 869376860,459 854663685,460 724511174,461 357575887,462 554601152,463 937815738,464 592437413,465 992324857,466 878495940,467 17450552,468 956432545,469 804037092,470 677837122,471 694998479,472 156762276,473 955878302,474 665780760,475 112590518,476 206803239,477 553709274,478 977333507,479 42914022,480 727817882,481 949565522,482 929356052,483 821163730,484 718397171,485 153319605,486 461193802,487 789116137,488 925605936,489 802825886,490 4737558,491 11647712,492 31189628,493 942544256,494 770042957,495 395278757,496 985733882,497 123533901,498 352242508,499 40259458,500 53501312,501 539100225,502 313069975,503 405177308,504 659044744,505 284605989,506 816626669,507 918521271,508 18239953,509 276592645,510 700050801,511 38981362,512 225961863,513 46257112,514 165334748,515 236853795,516 330921988,517 768046016,518 468836367,519 768867591,520 241190251,521 154176258,522 22335657,523 949023192,524 860545730,525 805252393,526 87221731,527 776545542,528 463480071,529 402535206,530 600906414,531 389636841,532 897829208,533 140770278,534 653323553,535 921504312,536 821487086,537 873563035,538 963692200,539 461479036,540 22708227,541 529098620,542 324691179,543 938766376,544 285418428,545 897924225,546 964545685,547 549528092,548 107339534,549 565997299,550 347026474,551 192397458,552 703149593,553 39965638,554 512937318,555 997398536,556 876923456,557 115670903,558 47064731,559 90047526,560 157492826,561 807443800,562 570877161,563 358127496,564 633705563,565 164596493,566 249397364,567 356949161,568 195958184,569 769414933,570 318511504,571 262607666,572 786449636,573 615136310,574 598195355,575 836171069,576 650874042,577 603829588,578 749642104,579 321098959,580 711418221,581 527606075,582 828808943,583 678037729,584 140290247,585 113081094,586 723084737,587 185748697,588 774770559,589 869803837,590 111914410,591 722673287,592 776295962,593 315220696,594 191649107,595 815581512,596 989959866,597 440552460,598 954917947,599 51832643,600 905359234,601 773143062,602 656936019,603 694396762,604 230381678,605 210807153,606 350381952,607 808610035,608 6255600,609 34540935,610 209273851,611 850049691,612 858488382,613 518231702,614 352113465,615 62780225,616 282807698,617 831007791,618 650980005,619 574846098,620 61553545,621 274523676,622 711602218,623 385129492,624 847405724,625 926456940,626 748171699,627 449810302,628 977518246,629 985455433,630 407941158,631 944376098,632 961465481,633 397544002,634 303218493,635 232461671,636 825676404,637 73156937,638 793859512,639 229878239,640 588044040,641 885332225,642 512768388,643 861633285,644 389606930,645 694205634,646 194738823,647 879852754,648 815534297,649 976940265,650 483320339,651 549677209,652 850304406,653 537645732,654 763800735,655 285775368,656 256937213,657 626323579,658 129602042,659 164697882,660 858050839,661 508655093,662 92498001,663 413904133,664 572605135,665 938286180,666 845867960,667 331523486,668 870971097,669 742327289,670 166738298,671 852205239,672 878706851,673 518111783,674 493899427,675 625687318,676 508889267,677 975932896,678 366338365,679 586089838,680 400821155,681 519465376,682 148599366,683 233385079,684 813214982,685 213016271,686 92651775,687 915860250,688 347210612,689 138592882,690 954499279,691 193516954,692 418315160,693 334344868,694 745343952,695 661884753,696 928697299,697 896202641,698 774306109,699 433312680,700 61535626,701 551137703,702 291277716,703 569084857,704 560850824,705 207761645,706 344411585,707 541493117,708 385881591,709 527167296,710 972233327,711 435058595,712 460703083,713 808370051,714 852361167,715 842857436,716 811548314,717 71840691,718 850230266,719 444048795,720 719568642,721 841077643,722 37374268,723 910911036,724 380889602,725 591441142,726 322484405,727 686543010,728 312730410,729 296791668,730 485513569,731 762038181,732 223210260,733 208949131,734 427736469,735 854695282,736 760863108,737 644991768,738 347597952,739 617800021,740 19052932,741 893751395,742 890515798,743 740708512,744 38270286,745 79536163,746 508038945,747 950953359,748 890422385,749 608498474,750 814271884,751 134656944,752 145958542,753 919211570,754 65580922,755 831269158,756 920725364,757 758904322,758 837289035,759 909873432,760 751347744,761 571322117,762 412310164,763 554173921,764 103197044,765 321531552,766 244143119,767 606838431,768 194182488,769 595422111,770 520145167,771 779150926,772 290754911,773 514905902,774 396823286,775 638387592,776 821376592,777 250422322,778 641508719,779 443196302,780 434432513,781 580876960,782 939807718,783 679698500,784 11928162,785 617383215,786 908103245,787 955672507,788 767518600,789 506326023,790 689470888,791 555604927,792 522942640,793 653657429,794 235305617,795 297446847,796 779782477,797 208904077,798 424325305,799 956283053,800 770105711,801 441349935,802 815608638,803 18405552,804 658812718,805 972528815,806 369404560,807 183684391,808 124265017,809 267910927,810 356894296,811 111621739,812 529345682,813 104542192,814 413221077,815 320826511,816 22878970,817 936015591,818 521358984,819 707820868,820 395512066,821 77004612,822 679404096,823 522336398,824 793321689,825 559568738,826 508685973,827 578049973,828 444891489,829 503407698,830 318836053,831 348514436,832 731735990,833 144125725,834 286678449,835 527619095,836 757313658,837 594982669,838 941157496,839 232274069,840 347985723,841 773072315,842 465547591,843 461633227,844 117732755,845 810251922,846 973570259,847 690079220,848 862125590,849 405390982,850 929531742,851 919050452,852 148479573,853 469923670,854 882510483,855 938455480,856 323804525,857 807154980,858 299129215,859 512698337,860 983783156,861 751763213,862 749312006,863 815493791,864 967738640,865 225493197,866 63704527,867 296466004,868 378971759,869 296064821,870 293022007,871 138037379,872 406318776,873 92301376,874 891215287,875 713880959,876 210068289,877 74761488,878 404205329,879 887848476,880 377336575,881 598591425,882 740241469,883 579039655,884 707424303,885 743508880,886 508044416,887 933801198,888 417336607,889 6641719,890 632493878,891 829949634,892 934986008,893 117558839,894 793324833,895 691881415,896 158669788,897 673145144,898 820731009,899 32414445,900 611205310,901 581553561,902 299672197,903 50087294,904 763828341,905 54649639,906 34603442,907 136776772,908 734063953,909 191306524,910 411957664,911 306220597,912 641010972,913 732062230,914 294024691,915 676209669,916 855152945,917 110310116,918 441955786,919 764396778,920 960076821,921 986605635,922 240924926,923 89200253,924 883564498,925 213610179,926 794284614,927 180504879,928 311532380,929 103685117,930 29318893,931 859497914,932 123022643,933 642491134,934 506975174,935 539188342,936 653062362,937 370329281,938 899862913,939 865854570,940 833716225,941 201342523,942 732034769,943 858640413,944 383934495,945 105403121,946 922169592,947 714395656,948 262004557,949 995525106,950 271470066,951 898640808,952 223086637,953 300555377,954 251021366,955 973949389,956 106904706,957 905028403,958 124542256,959 18729468,960 927960082,961 130713489,962 42978748,963 375630436,964 784068231,965 105581268,966 745310754,967 982387885,968 208110234,969 998472740,970 950242139,971 361480170,972 605835061,973 378791938,974 385426704,975 173490007,976 840989527,977 750889691,978 558296961,979 592578382,980 543430494,981 863101818,982 452224004,983 806813385,984 262208764,985 451457428,986 668767606,987 992312960,988 53772933,989 932568167,990 515094846,991 218715670,992 117192714,993 160127821,994 347549713,995 358842285,996 42881586,997 157404256,998 162188817,999 987671544,1000 34352859,1001 285529186,1002 187037073,1003 185282309,1004 613176701,1005 583805804,1006 415389541,1007 982504602,1008 582655326,1009 692944767,1010 791060529,1011 653901743,1012 758139384,1013 412842816,1014 591346325,1015 284856664,1016 604258399,1017 57101119,1018 417373117,1019 552335265,1020 306923153,1021 658164059,1022 693325423,1023 712496532,1024 243341024,1025 954079355,1026 954171997,1027 332665840,1028 100123831,1029 516429516,1030 224486773,1031 736914487,1032 103798490,1033 748436667,1034 460116016,1035 154132405,1036 133096029,1037 327951209,1038 693862799,1039 743760820,1040 368227215,1041 83833428,1042 706476338,1043 597799039,1044 887903365,1045 808868241,1046 819069341,1047 798366030,1048 409741371,1049 331989592,1050 974380265,1051 355152189,1052 502669015,1053 299669502,1054 658698592,1055 260721334,1056 756907437,1057 106131102,1058 554228613,1059 675166664,1060 316108544,1061 41960962,1062 258077325,1063 369512709,1064 418350618,1065 874766574,1066 376087919,1067 480195102,1068 610217443,1069 481367251,1070 17850657,1071 923139615,1072 773487855,1073 907166850,1074 818613197,1075 707741058,1076 538447172,1077 654448469,1078 301727530,1079 854575979,1080 617288980,1081 495740226,1082 384519077,1083 96426684,1084 36766398,1085 271761898,1086 80220413,1087 889315125,1088 460099516,1089 108304710,1090 648352858,1091 7314411,1092 220769737,1093 69095862,1094 850716074,1095 934288426,1096 603365099,1097 27452685,1098 423573676,1099 171631012,1100 219605931,1101 190726232,1102 619001091,1103 691641432,1104 404661929,1105 912200580,1106 60191502,1107 114705589,1108 563699388,1109 502459100,1110 582493068,1111 84088001,1112 496103606,1113 621610493,1114 907612877,1115 432882558,1116 881745477,1117 663664476,1118 45545571,1119 375574995,1120 364910810,1121 36413928,1122 158330550,1123 5056208,1124 170778091,1125 716452055,1126 974143473,1127 737038596,1128 67187161,1129 163282278,1130 239947775,1131 441358930,1132 938040191,1133 485374724,1134 760133531,1135 121152843,1136 192270637,1137 395353794,1138 628034439,1139 918570527,1140 421180159,1141 957821999,1142 872665061,1143 416003792,1144 541658539,1145 235698501,1146 206801418,1147 958944011,1148 772092674,1149 635997681,1150 756922613,1151 778723951,1152 595778086,1153 452249410,1154 278650048,1155 154538094,1156 593808447,1157 247046746,1158 645506659,1159 713209009,1160 362796769,1161 287679252,1162 211356787,1163 675393910,1164 648795529,1165 678918204,1166 181634500,1167 671169987,1168 243628940,1169 898107096,1170 606668651,1171 685422894,1172 948167874,1173 888202254,1174 602499367,1175 478380012,1176 660152465,1177 381546363,1178 573378116,1179 290546006,1180 519278660,1181 447312924,1182 226571410,1183 345078210,1184 21942937,1185 906487017,1186 748462085,1187 966453564,1188 660629529,1189 572178985,1190 30369095,1191 820953554,1192 521458401,1193 733228100,1194 706817886,1195 717736765,1196 859096943,1197 271561561,1198 961962384,1199 686499326,1200 789113257,