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