CT56203

The Secret Fixed Window Peak

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the temple city of Sunspire close for winter, Dante must finish the panels ledger - one figure at a time. Task: Print the maximum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the maximum window sum. Constraints: 1 <= k <= n <= 3408; 1 <= a[i] <= 1000.

Example 1:

Input: 825 124 469 230 583 909 615 492 960 213 615 398 740 135 787 383 207 352 474 254 310 422 907 282 387 538 492 634 853 261 236 458 48 365 791 775 951 485 760 244 276 596 638 410 890 327 282 973 623 229 637 887 906 240 328 529 389 611 152 37 297 227 986 951 304 336 341 381 87 212 695 780 857 13 405 49 585 538 418 146 288 238 429 260 934 208 687 247 938 691 435 632 172 496 27 178 16 239 834 782 987 619 728 828 103 452 864 371 664 175 718 346 154 216 700 551 38 79 95 298 138 439 252 861 406 392 920 748 800 736 757 640 363 755 965 702 523 817 802 107 705 787 890 622 923 177 21 106 119 101 65 846 28 509 655 711 767 409 829 183 191 575 20 143 270 904 957 936 742 912 14 603 38 437 483 831 860 705 661 168 631 599 37 180 132 673 176 654 787 294 375 846 140 511 589 905 266 878 793 484 579 305 545 40 49…
Output: 67138

Example 2:

Input: 1189 391 76 394 365 873 188 464 282 965 814 348 839 222 286 274 38 681 648 313 201 102 877 881 702 672 705 616 489 249 633 305 352 364 366 60 164 644 398 803 848 357 341 654 516 23 805 1 360 290 461 956 547 378 829 356 370 557 143 661 312 282 6 674 326 955 136 271 448 453 51 799 599 200 20 806 996 747 961 971 635 924 323 737 802 325 79 650 669 665 195 544 278 363 404 5 620 946 439 254 962 31 690 528 579 521 773 610 559 905 910 866 864 893 409 603 736 336 340 744 540 427 67 760 274 440 625 350 66 393 840 55 784 210 872 137 659 881 814 446 274 519 616 512 413 296 137 549 482 779 832 573 127 726 666 824 214 954 546 50 407 14 790 171 670 616 736 993 194 608 555 878 171 767 912 158 665 466 43 107 343 593 372 429 378 553 313 123 485 799 425 472 678 567 42 725 761 641 856 233 810 69 647 677 630 5…
Output: 208764

Example 3:

Input: 920 394 74 527 642 357 526 311 320 502 991 581 477 617 421 529 654 28 822 113 658 109 22 867 305 124 976 458 632 680 704 377 930 860 928 31 488 947 422 334 446 67 326 252 678 502 374 942 988 168 583 496 727 106 854 828 753 720 324 604 66 700 974 538 331 380 136 876 965 394 993 673 243 550 71 415 430 894 533 15 186 618 381 194 384 551 60 907 991 811 482 247 139 599 226 308 544 846 931 621 730 725 465 558 848 74 622 93 116 280 993 663 365 814 183 569 301 969 758 115 526 169 915 125 598 890 499 994 336 611 379 88 158 916 332 721 273 838 295 593 175 656 75 768 639 539 260 904 952 829 356 131 231 197 377 916 10 309 207 326 186 839 87 594 983 39 300 604 22 786 568 645 644 31 287 282 165 224 823 794 176 445 424 462 921 366 92 508 932 809 953 686 688 252 671 949 741 204 946 615 985 482 683 437 484…
Output: 203600

Constraints:

1 <= k <= n <= 3408; 1 <= a[i] <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
The Secret Fixed Window Peak - MEDIUM Coding Problem | CodeTikki