CT36070

Darian and the Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the ferry landing of Crosswater close for winter, Darian must finish the panels ledger - one figure at a time. 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 <= 2894; 1 <= a[i] <= 1000.

Example 1:

Input: 617 188 235 555 521 846 541 178 359 304 653 917 238 251 192 539 832 898 188 626 853 387 869 647 643 183 205 376 797 902 804 387 344 687 355 703 556 62 828 6 341 187 69 346 755 504 627 14 205 228 647 719 623 2 649 162 191 240 158 408 322 137 510 904 941 780 56 267 786 220 606 7 123 965 907 535 293 203 105 876 618 971 741 939 105 397 851 420 206 262 98 313 761 140 441 230 809 557 211 604 612 647 157 336 481 667 87 43 302 134 213 367 281 160 657 395 137 768 554 247 250 58 141 485 458 784 851 164 743 859 560 221 213 60 131 167 541 644 858 259 349 141 601 761 787 119 703 487 71 706 139 841 660 679 803 865 596 866 63 635 906 681 757 11 519 852 205 582 110 832 696 104 567 87 777 643 459 324 770 549 884 555 915 330 403 128 615 646 480 223 537 922 908 74 175 923 699 87 688 156 825 644 3 570 255 793…
Output: 86557

Example 2:

Input: 1254 564 727 886 278 725 422 720 914 343 869 29 326 624 376 327 884 73 599 577 812 64 154 43 428 808 501 45 482 137 294 716 9 981 715 443 877 731 603 470 272 214 253 235 969 459 147 685 380 205 718 498 366 250 348 266 550 338 690 996 433 246 780 205 531 952 476 15 26 549 764 592 153 84 306 298 216 419 920 410 302 898 31 405 370 278 403 699 12 535 496 68 187 503 326 751 74 108 496 447 873 489 400 991 532 304 92 489 867 738 882 718 29 860 687 480 532 80 775 669 18 481 248 989 993 713 848 44 692 127 598 509 672 203 98 427 107 794 62 721 568 845 160 841 115 436 279 356 159 589 580 313 987 248 723 145 365 722 731 478 333 662 708 753 570 842 521 932 119 353 594 213 291 255 898 395 171 88 802 1 158 634 192 35 949 924 573 828 178 898 181 996 643 51 176 734 519 832 488 827 986 430 10 444 646 28 509…
Output: 274965

Example 3:

Input: 1313 522 959 409 65 355 390 783 796 65 550 961 463 715 299 345 430 227 380 388 791 642 294 234 827 781 780 415 949 846 18 479 693 260 914 682 597 3 105 646 435 824 868 125 228 369 776 468 874 372 225 904 188 492 255 408 625 758 394 391 832 936 160 241 548 595 995 145 282 276 301 361 129 648 941 870 254 810 364 670 327 582 789 659 405 798 269 486 854 297 913 390 438 798 943 601 853 915 363 619 516 901 942 502 901 202 128 698 527 423 342 207 534 378 509 13 578 179 942 73 682 49 142 260 175 450 535 633 269 804 996 834 188 654 865 112 764 693 256 770 185 471 151 976 765 265 46 24 238 117 430 5 820 633 468 298 376 621 343 999 460 616 721 212 602 723 17 595 914 664 930 849 526 567 326 741 703 902 145 119 182 174 581 954 877 316 554 989 657 473 900 905 163 976 795 52 410 456 184 462 445 84 292 46…
Output: 250875

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Darian and the Calm Window - MEDIUM Coding Problem | CodeTikki