FPEvalDataset/LeetCodeProblem
0305
1{2 "id": 3299,3 "name": "find_the_maximum_number_of_elements_in_subset",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/find-the-maximum-number-of-elements-in-subset/",6 "date": "2024-01-21 00:00:00",7 "task_description": "You are given an array of **positive** integers `nums`. You need to select a subset of `nums` which satisfies the following condition: You can place the selected elements in a **0-indexed** array such that it follows the pattern: `[x, x2, x4, ..., xk/2, xk, xk/2, ..., x4, x2, x]` (**Note** that `k` can be be any **non-negative** power of `2`). For example, `[2, 4, 16, 4, 2]` and `[3, 9, 3]` follow the pattern while `[2, 4, 8, 4, 2]` does not. Return _the **maximum** number of elements in a subset that satisfies these conditions._ **Example 1:** ``` **Input:** nums = [5,4,1,2,2] **Output:** 3 **Explanation:** We can select the subset {4,2,2}, which can be placed in the array as [2,4,2] which follows the pattern and 22 == 4. Hence the answer is 3. ``` **Example 2:** ``` **Input:** nums = [1,3,2,4] **Output:** 1 **Explanation:** We can select the subset {1}, which can be placed in the array as [1] which follows the pattern. Hence the answer is 1. Note that we could have also selected the subsets {2}, {3}, or {4}, there may be multiple subsets which provide the same answer. ``` **Constraints:** `2 <= nums.length <= 105` `1 <= nums[i] <= 109`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "nums = [5,4,1,2,2]",12 "output": "3 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,3,2,4]",17 "output": "1 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 581830539,24 469892822,25 391753860,26 273339289,27 257066763,28 539696610,29 432533761,30 25246031,31 44758299,32 321838571,33 112942657,34 938271380,35 903004662,36 321629320,37 707452811,38 118093002,39 439957938,40 33711650,41 632836947,42 279030621,43 567511258,44 836112157,45 523295507,46 781712349,47 147381132,48 459525461,49 129583359,50 514576513,51 759401352,52 118081590,53 673536192,54 569561263,55 221889488,56 740560280,57 604437349,58 895356803,59 853576856,60 758080012,61 901216362,62 884180694,63 857629136,64 861619336,65 728922416,66 454003916,67 40509093,68 151779530,69 249650506,70 804251658,71 832316532,72 277226687,73 384829644,74 241809654,75 438710769,76 458581043,77 531544632,78 89752851,79 869696720,80 439603340,81 748821067,82 567180143,83 977170139,84 382003653,85 352324488,86 765433545,87 480188666,88 464473913,89 798770250,90 63298702,91 356778342,92 787434817,93 714626797,94 838002770,95 28094213,96 105088473,97 709765634,98 720371079,99 725833983,100 404453536,101 102186174,102 772398376,103 956996360,104 257776697,105 393877529,106 462174291,107 405541705,108 65965021,109 209533305,110 747756011,111 634397282,112 442871237,113 551681575,114 588085549,115 986099568,116 595872159,117 443671,118 354813986,119 799092880,120 497027576,121 445548553,122 610321601,123 680163630,124 342400502,125 350225084,126 71981540,127 357469548,128 77575504,129 437168758,130 223971294,131 994671189,132 35220375,133 261726658,134 751440246,135 248898699,136 938197502,137 280569027,138 297866932,139 589445530,140 257126542,141 596233881,142 457504904,143 21985371,144 220081360,145 80721329,146 84909427,147 912721985,148 629439029,149 119791126,150 176379606,151 166680194,152 719099492,153 981113367,154 646451846,155 234128160,156 618862291,157 253927820,158 10830258,159 705511802,160 510284547,161 161731547,162 883330112,163 613162470,164 37327026,165 851336096,166 751468866,167 503737502,168 457082559,169 70833388,170 158928208,171 591842839,172 848302306,173 546943319,174 706060666,175 663549399,176 740590385,177 59869188,178 359794616,179 554135891,180 342779626,181 439869072,182 436927630,183 48470614,184 367229455,185 619673133,186 715899942,187 350220060,188 917293313,189 221176162,190 251666398,191 402314911,192 311061399,193 366477108,194 302515888,195 695412252,196 618268482,197 726914179,198 362107581,199 760393973,200 707562675,201 813613547,202 690714811,203 424534376,204 947108789,205 771035939,206 177936624,207 180287655,208 500293950,209 509208028,210 76791311,211 322906969,212 801867647,213 68946471,214 967321310,215 533093357,216 970306655,217 189976687,218 125439217,219 210974868,220 368021005,221 49235915,222 643516283,223 858795537,224 404953656,225 413718004,226 447761485,227 308665747,228 259057592,229 241439981,230 242147739,231 892189198,232 853061344,233 940915949,234 998694497,235 836014108,236 17797112,237 470584831,238 618955235,239 271203993,240 772483299,241 128064993,242 68149884,243 268926366,244 539656447,245 519981828,246 980824244,247 618834400,248 795039770,249 687753217,250 534188091,251 176794173,252 845762253,253 99273268,254 463801980,255 321129781,256 804772637,257 196000810,258 548824202,259 206188982,260 987534662,261 938445532,262 626681961,263 721077781,264 421230100,265 316205995,266 627604785,267 416874440,268 635606151,269 79421092,270 625587018,271 111668499,272 930098703,273 318953076,274 529450193,275 491187386,276 721907465,277 597725021,278 389606549,279 241979394,280 405412051,281 272623074,282 752649422,283 346309646,284 673244739,285 954178547,286 863352046,287 532208078,288 934755328,289 241649801,290 960526440,291 65573869,292 783370791,293 613519416,294 580857512,295 785639685,296 430843905,297 859434518,298 803377278,299 116435110,300 600836004,301 62713496,302 92544894,303 20488514,304 803597563,305 604377471,306 481277451,307 525776782,308 812830990,309 120705077,310 307428727,311 76361419,312 743218949,313 919507307,314 248765944,315 835304703,316 361127256,317 744585778,318 570483077,319 589618530,320 782841523,321 720078842,322 330861110,323 248721496,324 378231205,325 663011819,326 80948591,327 183982116,328 990006652,329 159195152,330 321171596,331 930156579,332 244388359,333 645768153,334 107850133,335 5925240,336 113742223,337 191009853,338 266474212,339 765253171,340 87129122,341 377488013,342 491802386,343 181553442,344 827935874,345 235629766,346 854390204,347 100315978,348 609965222,349 219050368,350 184370397,351 24207428,352 688760799,353 783576564,354 699687952,355 153089178,356 676092135,357 816564835,358 47747298,359 966818373,360 230363095,361 651115614,362 52094590,363 159404248,364 319755444,365 220972061,366 114129331,367 807558026,368 886219462,369 423274308,370 196828534,371 93999047,372 489045204,373 290902639,374 790082345,375 975870274,376 516798599,377 509059896,378 409524224,379 225363504,380 589117942,381 244439821,382 748331770,383 360930163,384 129853344,385 576448416,386 256717182,387 904864600,388 725393498,389 369188943,390 433335902,391 288474598,392 675766941,393 263089768,394 336759383,395 606831078,396 209042681,397 865359358,398 521315776,399 142635313,400 526510961,401 970213184,402 644489016,403 935597530,404 882691599,405 471794865,406 445103661,407 970770155,408 421235545,409 823843049,410 993093978,411 82913887,412 762783827,413 521448281,414 677534685,415 454934604,416 366858936,417 27182744,418 186464116,419 198315803,420 608799016,421 685504279,422 302374521,423 386508639,424 914298674,425 789036009,426 261356773,427 419072855,428 632237830,429 336738500,430 450358437,431 998594409,432 150425558,433 308947281,434 424315855,435 37404733,436 6217658,437 281222534,438 685154462,439 401232125,440 325830698,441 220233640,442 124022470,443 220564710,444 917615374,445 722766208,446 333377278,447 770325663,448 99232435,449 818174811,450 848725479,451 52854750,452 834648170,453 952497875,454 985671761,455 657786678,456 646624484,457 338302573,458 789194700,459 911024267,460 45439688,461 197417649,462 701833192,463 53882388,464 78582361,465 329615470,466 336995013,467 456943640,468 553533405,469 65569869,470 593960389,471 444657410,472 963742392,473 514410555,474 939345547,475 200292556,476 870009571,477 469238258,478 700876476,479 434941010,480 218049042,481 205833632,482 21968233,483 502809383,484 358990770,485 718618521,486 594068853,487 670920304,488 355177120,489 883940390,490 176360824,491 946823655,492 486298879,493 665946793,494 84915385,495 999387297,496 239403625,497 137322529,498 255274771,499 692985628,500 770781235,501 441803220,502 314222818,503 161874907,504 844005874,505 245842087,506 136292671,507 175144467,508 234024211,509 271101128,510 98125007,511 490106815,512 60158315,513 251313520,514 360630609,515 93801192,516 635304555,517 255985051,518 418252297,519 351202689,520 811746048,521 212425162,522 809405782,523 614463552,524 733000335,525 480199827,526 775221176,527 943234603,528 734011427,529 900044689,530 806945638,531 970039430,532 153523860,533 64216978,534 216109168,535 173437727,536 970685909,537 361859181,538 87590279,539 821300872,540 824472238,541 922581015,542 600281332,543 381477909,544 817171350,545 912043351,546 266130073,547 880473573,548 633616368,549 656786000,550 836269504,551 977077227,552 654648730,553 61256360,554 40742819,555 385598798,556 936303505,557 35487026,558 343091476,559 840619990,560 841640734,561 559506836,562 79405296,563 801868478,564 460647355,565 517701574,566 150352809,567 184428645,568 541052272,569 614373747,570 10967199,571 494907052,572 364865881,573 211239375,574 391985458,575 331749497,576 532967444,577 107661187,578 227053941,579 984700189,580 63340748,581 648449057,582 622538190,583 785370615,584 438885076,585 465645517,586 585288178,587 195730321,588 833284348,589 333266932,590 877761796,591 33897755,592 880077555,593 32278620,594 522927508,595 385043367,596 604497418,597 623762324,598 934094248,599 514371970,600 193685511,601 387341020,602 654126920,603 994966661,604 861112393,605 632024017,606 363624853,607 415466388,608 888544457,609 312699819,610 759993244,611 729424021,612 938614152,613 566260196,614 889528879,615 549815564,616 29414818,617 341781162,618 497076980,619 505781012,620 477343494,621 285640283,622 833147316,623 841247834,624 17169710,625 825973003,626 496343658,627 612197701,628 199923604,629 59348723,630 13666036,631 29726693,632 324854189,633 900039541,634 42479001,635 129679885,636 84298104,637 694880786,638 318110440,639 783861899,640 659273947,641 927020347,642 468005708,643 468644552,644 375906310,645 131388653,646 219111334,647 265111562,648 657451150,649 892661529,650 47647182,651 327684143,652 136567370,653 20582866,654 992607475,655 563299248,656 305928715,657 476009831,658 701998832,659 691729494,660 176696673,661 534002373,662 593307020,663 354772684,664 186397425,665 291459244,666 969998472,667 267832170,668 669033276,669 261226307,670 364938936,671 682886625,672 571547580,673 817855172,674 589082458,675 194094412,676 404752574,677 496701224,678 906442235,679 476969716,680 449932052,681 634373737,682 60446480,683 440770550,684 734533184,685 893457724,686 923364250,687 351829037,688 221212805,689 463228091,690 951351158,691 234219582,692 166414236,693 335526064,694 73063038,695 24584227,696 352524345,697 113431791,698 208959557,699 776040927,700 889403318,701 904498685,702 276494160,703 89616449,704 374499339,705 551536302,706 45670008,707 106447601,708 174709427,709 598120945,710 961563821,711 242744201,712 682561318,713 62547742,714 65966421,715 75905821,716 704670657,717 36446003,718 328079909,719 388343128,720 581583685,721 754722625,722 694093935,723 881772287,724 72618036,725 386531471,726 202676843,727 269902678,728 699831805,729 254829766,730 236011776,731 541017226,732 126745195,733 193837194,734 435638923,735 451381561,736 45970146,737 539607496,738 506877800,739 710083210,740 820814621,741 719538370,742 328885447,743 968843397,744 399011092,745 329518783,746 439037387,747 439328105,748 828061007,749 527274825,750 501394665,751 690181498,752 698595268,753 890764023,754 474213286,755 961655873,756 121046074,757 630177930,758 890115292,759 161274888,760 481898206,761 414508249,762 752238622,763 222787030,764 866595295,765 798927241,766 493790414,767 983237761,768 162241889,769 516970183,770 598061594,771 66622991,772 404689867,773 486139793,774 576271204,775 608269623,776 494442044,777 185468003,778 259595029,779 987306430,780 929241797,781 264952748,782 203585309,783 382199003,784 494348293,785 741446142,786 501105932,787 884751409,788 807193871,789 535462853,790 284903983,791 386236790,792 662426690,793 88156977,794 562948495,795 271121102,796 36670970,797 781498038,798 418175032,799 959412349,800 803938207,801 527472914,802 979465222,803 614142892,804 187763474,805 218406787,806 306296990,807 573339661,808 212212783,809 398858349,810 987482572,811 675679764,812 543594790,813 977802382,814 722938662,815 29395469,816 837582741,817 298205631,818 824709833,819 563742132,820 915545409,821 592610536,822 27467162,823 808579537,824 276834087,825 105282226,826 310715682,827 326989250,828 248675077,829 428904532,830 400831068,831 586252198,832 929885774,833 215393173,834 350360278,835 41287566,836 606308192,837 154653358,838 895076874,839 335590782,840 731791896,841 776525413,842 354636541,843 84605736,844 988224115,845 564039412,846 440007630,847 931237426,848 919205328,849 18862748,850 42428399,851 342647180,852 774183072,853 463844861,854 168445008,855 762322798,856 278490232,857 612576805,858 939845596,859 259642843,860 229635355,861 903792239,862 140675376,863 126437210,864 619936310,865 309279993,866 402324542,867 301042853,868 268867786,869 603614800,870 83840410,871 634930223,872 298007665,873 958987113,874 769515567,875 867919465,876 825729481,877 533957141,878 984684718,879 408812406,880 680166578,881 401765120,882 647046799,883 631933953,884 965668524,885 852561742,886 853861858,887 874324426,888 901832082,889 766456886,890 788720244,891 513332874,892 776603758,893 818827450,894 825080856,895 12927502,896 45320294,897 912457889,898 833781122,899 566999070,900 114254015,901 581298727,902 436332572,903 720758282,904 237496555,905 97115599,906 586751402,907 113871695,908 528924353,909 685337011,910 524749752,911 893992915,912 554102132,913 893653826,914 255900180,915 545590988,916 221741091,917 196956704,918 548697140,919 105271693,920 96027617,921 784955048,922 602151097,923 614617851,924 83120548,925 757733988,926 651777671,927 961284958,928 467046507,929 966347566,930 914772342,931 266010366,932 694771650,933 445896028,934 984500089,935 657607040,936 775770364,937 897031396,938 984904677,939 972422956,940 843321737,941 338332228,942 936020309,943 845501079,944 671138088,945 100415837,946 990100743,947 595045327,948 291888558,949 481323385,950 690138917,951 346337871,952 642775289,953 983525152,954 713119619,955 133833,956 14195671,957 176287262,958 905389044,959 578586408,960 111195443,961 859921844,962 464157496,963 303318591,964 445479701,965 737884250,966 525159708,967 883720628,968 262433053,969 31937224,970 659955475,971 627830732,972 384361273,973 844665515,974 871569977,975 607194645,976 67663057,977 505422965,978 626684273,979 341764063,980 344382786,981 242488756,982 754583615,983 607409617,984 766417424,985 880297097,986 671072650,987 341398609,988 928477822,989 891543746,990 753516164,991 832502870,992 792626855,993 971042386,994 370851113,995 318240734,996 424483467,997 890181906,998 171861351,999 114481542,1000 542111835,1001 41574166,1002 811710574,1003 33765178,1004 288825304,1005 150086975,1006 582530460,1007 60728057,1008 488869119,1009 252570170,1010 33077547,1011 73351248,1012 345003697,1013 972722629,1014 180514883,1015 483307484,1016 64121805,1017 229101647,1018 489347572,1019 305443790,1020 114036664,1021 258678363,1022 276324038,1023 385570038,1024 407556479,1025 346693129,1026 418885039,1027 881713210,1028 530664760,1029 203378802,1030 252413194,1031 928211691,1032 187631869,1033 677169031,1034 399418408,1035 456629043,1036 760738133,1037 439421458,1038 65605285,1039 473909753,1040 575219703,1041 751485403,1042 917524797,1043 535280943,1044 175234402,1045 811327931,1046 885344159,1047 443425916,1048 310304010,1049 892637967,1050 998720771,1051 773734167,1052 581747096,1053 533797627,1054 108262336,1055 448830774,1056 419118597,1057 277282047,1058 726498158,1059 324584490,1060 292103693,1061 214622743,1062 805168824,1063 36441787,1064 862934921,1065 475260851,1066 365819531,1067 974941285,1068 205856828,1069 689187229,1070 168722731,1071 886062326,1072 76591718,1073 526104909,1074 354875387,1075 448240951,1076 542314415,1077 519934533,1078 314203210,1079 480076736,1080 122293741,1081 23600224,1082 474382703,1083 516179097,1084 98069137,1085 425063193,1086 596054841,1087 167161321,1088 470147568,1089 93135408,1090 29389716,1091 570991138,1092 566416431,1093 485259524,1094 431769755,1095 473333328,1096 374473950,1097 995691660,1098 235036266,1099 693097558,1100 753177046,1101 838196291,1102 18060706,1103 879104664,1104 882913576,1105 481128140,1106 928022309,1107 568197239,1108 366469261,1109 199297581,1110 652082500,1111 813022582,1112 492765124,1113 329361308,1114 68761547,1115 661368666,1116 301601968,1117 276870394,1118 784343924,1119 872102396,1120 664301157,1121 130129264,1122 381519216,1123 74821134,1124 61893846,1125 168195273,1126 932747541,1127 255333993,1128 570546834,1129 962163787,1130 342293342,1131 187140535,1132 918453991,1133 678173497,1134 103890243,1135 141351748,1136 948612326,1137 674142823,1138 124347742,1139 256227282,1140 217820719,1141 984031115,1142 585253680,1143 156349695,1144 136511115,1145 338706656,1146 88081089,1147 610002663,1148 142156408,1149 189474213,1150 794728950,1151 50709734,1152 493896795,1153 830867336,1154 899414120,1155 342254460,1156 553796925,1157 960473884,1158 787092109,1159 468536798,1160 270388689,1161 330372794,1162 452476452,1163 896613820,1164 911390887,1165 80835177,1166 790221670,1167 314037851,1168 677533599,1169 429926904,1170 790276693,1171 24823579,1172 763595026,1173 34070954,1174 517460609,1175 334265100,1176 674252750,1177 908866314,1178 512860863,1179 668034711,1180 640743943,1181 389138985,1182 125311515,1183 777943077,1184 939091630,1185 273698743,1186 82075823,1187 13220997,1188 849346221,1189 943115458,1190 142457941,1191 475989316,1192 955687671,1193 570353406,1194 820710210,1195 105745014,1196 231561619,1197 364362652,1198 156681127,1199 597161759,1200 655957896,