CT45163

Bram's Ruby Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the granite steps of Stonehallow, Bram studies rows of windows entries. One clean number will settle the guild's oldest argument. 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 <= 2067; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1087 483 243969882 79998504 29925756 578719371 221329826 968824246 496908559 44026146 569824770 971056361 673520824 708626670 735511673 231235314 392407954 116521400 632399269 496218836 968124773 936108221 43775668 661746929 469236532 394786127 688363033 169819178 600774153 626648010 700184966 525390397 551260443 416690581 584097409 411594588 66685722 601041606 614411139 444413335 484443525 268025627 446476613 231422233 556220230 162979660 317771002 537939239 721336259 623994753 443017859 247365901 744961816 423405061 363897820 607895191 269839070 163720616 869437524 904000155 90404522 89566047 112890209 896763743 263385230 771587517 986885832 801445539 238952224 965107247 61243770 71245077 989451982 287305100 393104895 191284120 480026126 745248829 313598481 176141674 425672294 19295452 3…
Output: 238284594868

Example 2:

Input: 813 157 15116813 636423148 165655498 256277542 779625574 783914439 30078050 3490105 299554991 855980788 569957007 981311105 649449672 738035932 288754572 441099312 573036359 293693081 115613616 721494058 759766915 812976495 468551250 512823541 837545988 224668803 788975022 799152905 256971508 692074780 545406916 790628294 247228959 942157646 907195404 584892132 626752097 444155931 540620679 335631243 264127144 491336752 927908751 273704911 857374691 22026203 165502350 210994654 889741551 830045419 146264031 744127691 954481049 750775305 613046771 493109312 310470387 483956002 52599464 437053964 479583710 543876310 34501913 162006658 367931678 613312775 233520959 207478310 43015278 155004790 353030779 292806569 527059143 102963903 433207677 387424173 88914211 8704120 476415979 849602032 979…
Output: 71030073059

Example 3:

Input: 959 181 337160507 389600528 276436452 336016221 420640812 156927635 369740872 698547683 484478335 128404497 263315176 464610042 213051093 625731099 318471255 461291567 326008841 329877832 688883309 656901338 36111058 248872261 248288719 419196692 431514292 538404624 667629575 618881333 47256578 163832048 421829192 38812264 633456626 151994332 437107006 100980212 757231676 201646555 301228039 656062833 674532450 948244902 603558269 132838260 525556066 386013404 232652552 809984061 914879666 807422872 848990660 694378043 788187738 179020604 704490735 171334299 614939828 766806924 508810069 618568776 34117937 903330256 893930672 888375895 729748239 449837356 787010028 953800397 946091905 73479561 194518501 68927533 563670672 927845879 112785644 350191421 457591199 447854485 303251459 65620412…
Output: 80233360152

Constraints:

1 <= k <= n <= 2067; 1 <= a[i] <= 1000000000.

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