FPEvalDataset/LeetCodeProblem
0302
1{2 "id": 2358,3 "name": "number_of_ways_to_split_array",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/number-of-ways-to-split-array/",6 "date": "2022-04-30 00:00:00",7 "task_description": "You are given a **0-indexed** integer array `nums` of length `n`. `nums` contains a **valid split** at index `i` if the following are true: The sum of the first `i + 1` elements is **greater than or equal to** the sum of the last `n - i - 1` elements. There is **at least one** element to the right of `i`. That is, `0 <= i < n - 1`. Return _the number of **valid splits** in_ `nums`. **Example 1:** ``` **Input:** nums = [10,4,-8,7] **Output:** 2 **Explanation:** There are three ways of splitting nums into two non-empty parts: - Split nums at index 0. Then, the first part is [10], and its sum is 10. The second part is [4,-8,7], and its sum is 3. Since 10 >= 3, i = 0 is a valid split. - Split nums at index 1. Then, the first part is [10,4], and its sum is 14. The second part is [-8,7], and its sum is -1. Since 14 >= -1, i = 1 is a valid split. - Split nums at index 2. Then, the first part is [10,4,-8], and its sum is 6. The second part is [7], and its sum is 7. Since 6 < 7, i = 2 is not a valid split. Thus, the number of valid splits in nums is 2. ``` **Example 2:** ``` **Input:** nums = [2,3,1,0] **Output:** 2 **Explanation:** There are two valid splits in nums: - Split nums at index 1. Then, the first part is [2,3], and its sum is 5. The second part is [1,0], and its sum is 1. Since 5 >= 1, i = 1 is a valid split. - Split nums at index 2. Then, the first part is [2,3,1], and its sum is 6. The second part is [0], and its sum is 0. Since 6 >= 0, i = 2 is a valid split. ``` **Constraints:** `2 <= nums.length <= 105` `-105 <= nums[i] <= 105`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [10,4,-8,7]",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "nums = [2,3,1,0]",17 "output": "2 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 57980,24 71404,25 -93546,26 -23218,27 26424,28 75158,29 38334,30 -2404,31 -74341,32 -70915,33 25688,34 -66908,35 -27658,36 32104,37 -36350,38 -51448,39 -53539,40 83955,41 -59696,42 -82665,43 31408,44 -55262,45 73623,46 -67449,47 -9175,48 84631,49 -57269,50 63871,51 -75598,52 -64944,53 4070,54 -55626,55 74476,56 -80373,57 84954,58 29621,59 -3931,60 -78311,61 -73466,62 66246,63 87854,64 -77865,65 -74763,66 40355,67 12829,68 -49589,69 89903,70 61280,71 65746,72 -23192,73 15024,74 -3561,75 -82012,76 -73538,77 -82824,78 -3007,79 -26857,80 92192,81 -15661,82 45379,83 99807,84 -51306,85 -93965,86 -52143,87 -60733,88 -70641,89 -19032,90 96126,91 75474,92 -63438,93 -87714,94 -98774,95 23158,96 -33724,97 62526,98 -47561,99 93966,100 40063,101 40336,102 38424,103 30941,104 -40088,105 -90301,106 82540,107 71488,108 -85746,109 71052,110 -8281,111 51748,112 87535,113 80740,114 46727,115 -16622,116 -22504,117 99719,118 -52532,119 -69012,120 52132,121 15296,122 62766,123 -73482,124 98783,125 -99150,126 84997,127 -46016,128 -720,129 91124,130 74558,131 -93664,132 -65798,133 1461,134 53219,135 -94310,136 -34280,137 -63393,138 -37887,139 -5945,140 -83240,141 63417,142 85895,143 79315,144 28282,145 -94824,146 30347,147 -27055,148 48013,149 -38629,150 34178,151 -23826,152 -29908,153 -30305,154 -59086,155 -9692,156 -83504,157 49664,158 50316,159 -65654,160 16607,161 39080,162 64014,163 -69625,164 74261,165 -56836,166 -39590,167 -84503,168 63007,169 -61183,170 -39645,171 -35190,172 -84070,173 -47462,174 -49206,175 -35180,176 8061,177 -4060,178 5994,179 -74145,180 3119,181 44192,182 34976,183 30312,184 -45009,185 -51253,186 -95513,187 -28956,188 87907,189 -23367,190 -84488,191 -420,192 99460,193 22579,194 -85730,195 -23922,196 -65883,197 -49023,198 -85047,199 44249,200 32332,201 -22750,202 59133,203 63966,204 -83001,205 42580,206 -68866,207 21152,208 72338,209 23236,210 -59099,211 92464,212 -16254,213 -72712,214 68587,215 75927,216 68810,217 99684,218 -48884,219 -60292,220 -14744,221 -51354,222 20610,223 85572,224 41641,225 64708,226 98687,227 -64045,228 82276,229 -43061,230 22760,231 -52057,232 -97159,233 9673,234 55092,235 62045,236 55571,237 -51424,238 98867,239 93602,240 52771,241 -70725,242 -57256,243 -89006,244 4118,245 -68735,246 -57469,247 91060,248 -27069,249 -14422,250 -10866,251 -72212,252 48420,253 92826,254 63629,255 38647,256 -74456,257 63214,258 -34508,259 -35633,260 30009,261 73339,262 -20479,263 -98842,264 62301,265 -5879,266 -83484,267 79523,268 29888,269 29230,270 35889,271 -48236,272 13301,273 44479,274 17333,275 -96361,276 -93656,277 71061,278 -25109,279 55533,280 -82881,281 -14787,282 6239,283 -64446,284 -73540,285 3671,286 48420,287 47541,288 -76168,289 86014,290 -74179,291 75961,292 -45145,293 -30097,294 99231,295 -3452,296 23917,297 18951,298 85086,299 50908,300 27346,301 -90369,302 -23338,303 30631,304 -83914,305 -65947,306 73044,307 -33334,308 -51080,309 9682,310 -92608,311 -43287,312 54876,313 64467,314 43462,315 17521,316 -64659,317 47947,318 -39879,319 -31367,320 67128,321 67425,322 -62410,323 -98275,324 -12034,325 40742,326 35807,327 94362,328 94085,329 -53581,330 73625,331 -78712,332 -13506,333 11664,334 14870,335 -64181,336 -55583,337 -67353,338 -95325,339 -71111,340 -42379,341 83560,342 -30959,343 -8163,344 73662,345 -81379,346 17313,347 14989,348 -7387,349 53070,350 -70619,351 -14758,352 -30540,353 65197,354 90297,355 50830,356 68149,357 30119,358 51473,359 42240,360 -80517,361 71352,362 -72576,363 -91244,364 90660,365 -9131,366 25818,367 -138,368 -80874,369 56614,370 -48591,371 72063,372 27184,373 -64283,374 78985,375 62699,376 -34847,377 -70359,378 -81430,379 -70412,380 -56889,381 46943,382 78139,383 -55055,384 79358,385 66495,386 72406,387 80878,388 50562,389 -43236,390 8365,391 -39353,392 -32512,393 -17462,394 -88757,395 -16566,396 -92384,397 -37033,398 -66178,399 -75266,400 7808,401 -14258,402 40960,403 81225,404 47734,405 12056,406 65723,407 -95016,408 -75562,409 21205,410 93413,411 29847,412 21872,413 22318,414 -31324,415 11581,416 -20248,417 73145,418 -1718,419 -40893,420 68170,421 -25186,422 -59870,423 -93047,424 18068,425 -74342,426 -15532,427 80962,428 60415,429 4600,430 -86310,431 21051,432 -47069,433 96875,434 45093,435 10586,436 -75403,437 -12994,438 624,439 53458,440 30403,441 -30117,442 -52446,443 77474,444 25838,445 63537,446 65142,447 -6062,448 53644,449 81765,450 -21706,451 -11981,452 96700,453 72919,454 -34126,455 -64991,456 67908,457 -90406,458 -81141,459 85694,460 -5340,461 10553,462 -718,463 -66263,464 -99168,465 -34713,466 -56905,467 -36888,468 -74173,469 70730,470 47971,471 38155,472 67172,473 -20242,474 -33164,475 7324,476 -12117,477 87900,478 8787,479 68933,480 23667,481 48439,482 -4170,483 82589,484 -15633,485 -48085,486 16985,487 -95671,488 57151,489 94536,490 32319,491 -33842,492 -86111,493 -45061,494 -85510,495 12667,496 44711,497 -95327,498 -12111,499 67834,500 -55271,501 -13973,502 5511,503 87917,504 70944,505 10125,506 -98053,507 -90452,508 29515,509 60747,510 34478,511 23672,512 37024,513 -15459,514 -35453,515 -37783,516 421,517 -37079,518 -36947,519 -79261,520 44619,521 -3009,522 13219,523 -34730,524 94884,525 2772,526 12745,527 -23460,528 84390,529 90525,530 -38249,531 56500,532 36482,533 86730,534 -56583,535 -39300,536 -72291,537 84237,538 -54927,539 43800,540 -48125,541 60020,542 -44131,543 -11992,544 14401,545 -24447,546 -14113,547 -33083,548 -28812,549 -63227,550 -89016,551 92582,552 -61469,553 28831,554 -37983,555 437,556 -59517,557 -30968,558 97982,559 3383,560 -74974,561 -46080,562 36126,563 -74839,564 -15798,565 -64056,566 -2543,567 62937,568 9378,569 -99458,570 67378,571 68870,572 -22954,573 85043,574 25807,575 -6533,576 82915,577 83,578 -24080,579 -48124,580 39040,581 -16086,582 -4083,583 98692,584 -55234,585 53672,586 -43387,587 -14696,588 14883,589 -63122,590 -76476,591 -66357,592 -31575,593 -67215,594 -25413,595 14307,596 96466,597 5883,598 16149,599 19135,600 -5981,601 24916,602 -18737,603 -46859,604 86227,605 -48331,606 -76769,607 -42684,608 86781,609 52465,610 -7397,611 68139,612 -37455,613 74360,614 20449,615 50040,616 92557,617 -5194,618 -31455,619 45152,620 3884,621 51567,622 -95367,623 67098,624 35321,625 27388,626 84074,627 31900,628 -39713,629 -65343,630 -20877,631 89296,632 86794,633 63412,634 -68003,635 -98470,636 59352,637 -52088,638 -25785,639 -91771,640 -90947,641 -10254,642 46480,643 -75211,644 39975,645 -57912,646 -65916,647 -27826,648 52434,649 87646,650 7427,651 66370,652 -49273,653 -16549,654 -52235,655 94964,656 49678,657 -50824,658 -47010,659 -29736,660 6296,661 7298,662 -32009,663 -55069,664 32979,665 17828,666 -34544,667 -74487,668 1567,669 -91102,670 19839,671 63294,672 95990,673 -61905,674 10350,675 67639,676 88533,677 -32819,678 52785,679 61134,680 -44398,681 5706,682 16092,683 49417,684 28407,685 96100,686 -35198,687 7899,688 -82199,689 -60922,690 -92940,691 -40683,692 -79460,693 -18690,694 -37459,695 53911,696 -72526,697 -82082,698 -24856,699 9201,700 15309,701 -53292,702 -51706,703 63736,704 -49749,705 -50383,706 -98623,707 -8391,708 33213,709 -66333,710 -69587,711 -49668,712 -28024,713 -55475,714 32564,715 86848,716 -37133,717 -40220,718 -44905,719 40691,720 20079,721 74221,722 -62826,723 64101,724 -57547,725 20075,726 -33010,727 -36445,728 -74668,729 -20686,730 -67495,731 -92772,732 61715,733 -24736,734 -51102,735 -49566,736 -24569,737 -18063,738 10668,739 71161,740 -44345,741 -13068,742 -89249,743 8047,744 41098,745 -98913,746 63650,747 65490,748 12942,749 -21033,750 -97531,751 -988,752 -4067,753 -80050,754 -77850,755 15171,756 15047,757 -98932,758 -56602,759 -92112,760 -21723,761 91502,762 59531,763 3944,764 -7325,765 -67433,766 17808,767 50054,768 3438,769 87787,770 -10043,771 69920,772 -94712,773 -7969,774 77333,775 40754,776 -62465,777 76445,778 27946,779 -8909,780 98565,781 20032,782 88980,783 69508,784 -42097,785 -43764,786 -36731,787 -20032,788 -78220,789 -62647,790 13075,791 -44138,792 -82793,793 -54527,794 18180,795 -42877,796 94406,797 -14539,798 14902,799 -52778,800 73717,801 627,802 93771,803 -70087,804 -50935,805 -24674,806 -43226,807 34937,808 -46831,809 -48081,810 -1436,811 -31117,812 76411,813 86488,814 11618,815 44014,816 51641,817 -17564,818 55925,819 69654,820 -70677,821 91943,822 91499,823 -53822,824 -91722,825 -7040,826 -58902,827 -33792,828 -72541,829 -69662,830 88277,831 35606,832 -64398,833 38274,834 71894,835 12640,836 -22949,837 34609,838 78971,839 -36045,840 -68849,841 -88954,842 -78025,843 -7147,844 -39579,845 -60369,846 -90700,847 21826,848 30886,849 -12963,850 41238,851 -36485,852 -48379,853 -95659,854 -64449,855 13724,856 -97182,857 38147,858 -15647,859 71035,860 -73988,861 -27540,862 -87232,863 4739,864 86441,865 62841,866 -75135,867 -29405,868 -36243,869 -85391,870 79926,871 -73181,872 -64406,873 -83484,874 -9728,875 13715,876 35297,877 87811,878 -9915,879 -40908,880 32669,881 66390,882 -44520,883 -72332,884 -21598,885 15413,886 59045,887 -10079,888 24366,889 -9280,890 34418,891 -46581,892 48177,893 -52478,894 -11656,895 -27778,896 64125,897 78306,898 -3979,899 43902,900 13782,901 96356,902 3638,903 55162,904 50279,905 6705,906 65644,907 63673,908 -62171,909 -15478,910 -47070,911 -38867,912 63439,913 10797,914 96009,915 4713,916 11942,917 -35841,918 -189,919 59240,920 -44851,921 1766,922 -5733,923 6612,924 37785,925 27725,926 74397,927 77616,928 -19465,929 49247,930 -89821,931 -20801,932 -40110,933 2367,934 75642,935 1093,936 -51214,937 -12921,938 2752,939 98557,940 -65635,941 -18828,942 59351,943 44424,944 310,945 92940,946 28153,947 -71483,948 60283,949 62719,950 -76682,951 -75417,952 -50995,953 42206,954 20660,955 16134,956 -96364,957 92948,958 -31512,959 95045,960 -83866,961 -34169,962 -14353,963 -75783,964 67674,965 48602,966 90861,967 21846,968 99853,969 86900,970 47253,971 9380,972 -90255,973 -31964,974 -39848,975 -54634,976 44273,977 -15259,978 48849,979 39989,980 -68918,981 84260,982 -24444,983 -84851,984 86452,985 -28935,986 -80359,987 -41746,988 32640,989 34620,990 -7730,991 -46265,992 66114,993 -45276,994 -1074,995 38903,996 33159,997 -83184,998 -8629,999 29399,1000 58451,1001 -62828,1002 -41132,1003 31074,1004 98708,1005 -4004,1006 -28028,1007 -48175,1008 27160,1009 44492,1010 28399,1011 -80754,1012 35359,1013 -13935,1014 -6211,1015 7260,1016 -60184,1017 69173,1018 -97610,1019 -55003,1020 -8057,1021 84768,1022 239,1023 -50287,1024 20049,1025 77231,1026 69139,1027 -88406,1028 92851,1029 -34031,1030 -9424,1031 97610,1032 -66033,1033 -8798,1034 -63801,1035 46665,1036 79409,1037 -79999,1038 2896,1039 -63919,1040 53066,1041 -32715,1042 88042,1043 40577,1044 81215,1045 35084,1046 14925,1047 -86996,1048 -65652,1049 -8540,1050 -26302,1051 -77489,1052 -998,1053 70819,1054 -61826,1055 24657,1056 -69481,1057 22706,1058 4683,1059 12784,1060 52727,1061 81626,1062 32541,1063 29087,1064 -77140,1065 -81647,1066 8225,1067 67704,1068 49688,1069 -53529,1070 45034,1071 97570,1072 5670,1073 69952,1074 99982,1075 8767,1076 28689,1077 58534,1078 9424,1079 -50203,1080 1634,1081 -99969,1082 48214,1083 91873,1084 -53750,1085 -96460,1086 -85770,1087 -14880,1088 78779,1089 -41765,1090 -18442,1091 76276,1092 40483,1093 23084,1094 58869,1095 40367,1096 37868,1097 76932,1098 14494,1099 -92451,1100 -43070,1101 47929,1102 -28015,1103 -37635,1104 -85155,1105 -4166,1106 -52466,1107 -91439,1108 37260,1109 -88284,1110 65926,1111 63576,1112 -334,1113 60207,1114 2244,1115 10647,1116 -62862,1117 -82363,1118 -76861,1119 62026,1120 56136,1121 -54021,1122 -67929,1123 83970,1124 96244,1125 80360,1126 -12803,1127 33809,1128 23280,1129 68108,1130 -12813,1131 5318,1132 29993,1133 36336,1134 -32025,1135 -52387,1136 12241,1137 57457,1138 88096,1139 -26499,1140 83445,1141 88090,1142 44609,1143 -95180,1144 24828,1145 19329,1146 -45442,1147 64032,1148 -18793,1149 -79331,1150 -43462,1151 -62242,1152 79590,1153 -48963,1154 -42864,1155 -40055,1156 68639,1157 36365,1158 74726,1159 -51279,1160 -94971,1161 -49588,1162 -7861,1163 -23897,1164 68715,1165 68187,1166 -83341,1167 9808,1168 44825,1169 66054,1170 39945,1171 80397,1172 69133,1173 -33520,1174 97048,1175 -53572,1176 -32685,1177 -23108,1178 46417,1179 81817,1180 -80358,1181 -59035,1182 -30508,1183 74688,1184 75261,1185 73558,1186 45882,1187 -98619,1188 44654,1189 85423,1190 23401,1191 30763,1192 51530,1193 78902,1194 35477,1195 55335,1196 -31141,1197 79687,1198 -33675,1199 -32365,1200 -55398,