CT52420

Freya's Obsidian Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the terraced vines of Grapehollow. Freya spreads the segments records across the table and picks up a sharp pencil. 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 <= 2560; 1 <= a[i] <= 1000.

Example 1:

Input: 863 408 969 628 223 496 528 891 635 175 681 115 880 893 588 505 828 966 129 359 682 697 111 319 507 569 52 927 771 73 716 718 836 897 673 321 873 280 917 755 21 423 642 584 134 667 117 944 471 681 611 355 759 796 406 445 949 847 832 495 446 716 481 3 222 509 593 285 383 260 317 602 224 847 174 837 775 11 611 809 315 864 764 849 256 707 286 334 52 225 791 437 875 550 373 255 615 957 837 916 991 628 499 965 438 968 827 254 50 199 866 933 721 858 321 561 126 530 945 307 82 849 266 203 195 862 217 894 1000 171 776 524 744 811 81 449 476 733 339 911 308 269 525 82 98 695 781 1 628 437 302 864 571 228 331 654 45 797 572 532 604 810 128 820 918 710 861 388 722 627 631 661 43 41 844 167 857 480 155 354 13 105 700 556 636 662 583 748 645 483 861 498 652 826 665 628 973 659 708 754 188 745 459 674 4…
Output: 199796

Example 2:

Input: 590 286 70 128 312 371 487 644 881 799 206 325 558 3 527 216 869 3 67 83 930 120 763 497 485 863 966 921 162 20 713 717 944 472 757 859 195 345 344 451 395 561 507 63 29 351 126 185 502 804 467 438 692 794 616 715 546 232 481 96 887 687 546 946 440 44 964 680 682 917 561 5 994 479 132 832 330 942 874 979 690 8 709 542 42 427 918 77 293 252 913 612 837 785 42 761 852 747 490 197 612 849 255 874 341 459 220 879 859 718 570 637 907 524 659 578 164 859 574 498 300 707 725 306 668 824 205 271 524 296 333 935 370 731 47 912 823 779 851 738 396 858 636 731 684 410 958 342 665 45 969 115 629 576 296 948 985 561 771 706 549 384 471 350 867 379 589 984 987 342 589 569 969 249 694 695 517 637 23 49 240 258 466 993 201 595 431 796 573 363 28 167 135 761 43 683 516 105 751 199 486 271 772 424 913 972 4…
Output: 141495

Example 3:

Input: 284 150 344 804 877 886 886 553 24 964 449 339 934 875 686 651 405 507 629 871 282 436 445 423 734 492 726 430 198 555 231 269 180 707 939 309 233 262 732 525 705 404 686 67 403 693 617 931 826 388 835 5 805 433 327 448 888 141 779 855 599 392 687 694 407 743 754 995 32 263 439 722 677 495 763 48 917 379 181 592 93 820 856 43 1000 549 517 183 456 411 421 259 898 218 159 193 661 772 57 167 925 246 383 675 1 501 27 82 961 472 215 993 825 235 69 133 490 617 670 518 549 813 472 853 945 332 223 64 869 591 110 885 316 747 328 894 547 425 522 460 260 604 427 288 429 849 703 936 719 852 723 718 183 720 51 487 890 312 412 683 121 648 485 183 133 845 668 166 246 535 843 84 84 630 453 124 42 126 134 776 79 207 855 335 487 285 17 680 113 183 105 519 545 714 225 449 206 60 667 445 259 422 550 872 133 5…
Output: 68600

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Freya's Obsidian Ledger - MEDIUM Coding Problem | CodeTikki