CT45387

Chavi's Calm Window Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the wren hedges of Thimblewick, someone must prove the quality of the harvest. This year the task falls to Chavi, armed only with the stretches register. Task: Print the minimum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the minimum window sum. Constraints: 1 <= k <= n <= 1932; 1 <= a[i] <= 1000.

Example 1:

Input: 1437 595 129 879 948 212 265 464 288 191 57 157 582 109 758 882 887 54 359 355 235 854 183 583 749 921 265 435 469 566 393 644 16 446 272 933 668 2 569 693 317 410 373 735 224 738 461 727 409 158 193 990 989 863 752 932 639 997 466 420 639 563 23 320 641 198 551 756 905 874 380 243 1 472 88 482 588 878 816 109 491 96 344 841 275 211 388 351 278 358 789 22 890 406 819 828 490 855 248 671 673 564 52 834 903 366 183 179 240 894 606 242 870 856 475 689 83 128 892 812 903 749 187 125 148 18 247 666 392 985 566 359 801 633 14 208 610 941 611 451 746 758 315 337 308 245 807 862 86 554 865 958 967 351 716 957 860 110 282 343 863 695 342 24 538 607 522 285 688 320 982 592 664 803 797 843 838 939 695 538 740 285 975 234 822 121 870 316 13 95 161 847 326 482 723 617 27 92 127 119 927 590 455 382 625 …
Output: 292073

Example 2:

Input: 1611 1251 813 902 768 44 227 161 421 509 151 40 683 221 265 163 663 288 417 167 141 114 114 986 885 750 601 188 984 525 832 196 148 145 878 221 503 538 570 630 602 838 905 405 875 683 596 472 8 91 156 556 663 865 708 743 542 151 280 666 968 67 822 295 505 12 301 231 892 669 559 162 199 458 176 851 526 248 211 64 919 686 18 405 750 454 129 283 182 937 747 193 613 979 818 230 347 365 72 642 265 30 182 640 335 165 710 618 337 383 688 989 835 72 232 95 979 78 713 911 339 577 991 35 4 888 529 324 859 236 390 682 250 364 939 765 954 861 408 827 399 770 445 456 457 520 667 841 135 531 131 261 718 965 367 452 985 142 365 35 350 1000 507 250 581 897 896 7 940 65 530 715 151 741 259 86 949 428 814 588 375 537 398 556 511 233 693 871 429 800 916 701 100 934 282 960 509 510 45 784 672 525 517 272 365 …
Output: 621242

Example 3:

Input: 441 380 60 599 986 336 568 658 111 559 45 4 346 283 930 34 178 232 520 413 879 135 91 893 681 933 357 976 364 697 646 115 6 368 457 403 440 416 335 48 610 390 113 350 628 647 642 58 951 357 105 852 365 536 582 861 691 492 850 507 674 835 405 608 635 497 834 903 34 102 480 292 165 328 284 198 818 146 877 514 152 156 213 739 457 906 976 964 179 27 226 515 530 653 675 408 762 375 496 419 438 947 539 804 604 428 644 568 219 721 167 554 743 28 134 202 178 967 765 535 534 996 852 475 972 482 933 636 304 158 730 704 32 621 70 455 833 617 795 248 908 216 387 211 562 635 541 236 813 755 134 904 174 627 852 226 636 778 213 117 267 307 160 315 222 998 75 675 810 526 355 447 527 796 484 362 626 739 214 194 17 113 916 474 637 33 914 60 633 848 885 156 686 385 768 706 499 806 889 234 445 871 225 962 453…
Output: 184889

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Chavi's Calm Window Ledger - MEDIUM Coding Problem | CodeTikki