CT53548

The Calm Window of Ironvein

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the mining town of Ironvein, Yara records each scrolls in a worn leather ledger. The guild wants answers, not guesses. 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 <= 3746; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 3345 724 935639 115678 -367376 -803656 812679 -947494 745410 741926 373591 373382 582563 -462526 304926 -893458 835178 -696390 -144067 287372 968922 -910653 -311377 853153 -880590 -130176 609167 758751 -112574 723647 -515740 -995818 -396832 758861 568498 -258074 606208 735967 -48861 929635 -607018 314112 -218817 482449 957953 963021 -468569 419281 644176 -382145 -218876 -990793 -432958 -125631 -403724 -990036 315991 -248654 428336 -289349 324871 254505 249986 560154 527541 106377 -306517 -654716 -581493 705294 45613 -641649 11839 -426719 587061 -473137 -809445 -964954 -404878 -802038 904555 261380 891389 -60940 30038 472218 -743903 -364709 86334 -191485 -734770 809069 79484 358554 -455300 -317219 -464996 -16631 -556251 -610453 -792786 -531158 589645 214188 -932920 393 473881 -920193 -22554…
Output: -31571584

Example 2:

Input: 2952 981 241405 546492 28766 411949 729689 879259 -579711 -35009 814140 541998 -723342 -765774 258982 961473 448470 284066 -766019 167984 353822 423764 672838 186019 -114098 -213437 311910 565260 -967343 577754 568430 144400 322715 -384161 -189760 322930 -468449 -368618 -58330 777792 -52088 440835 -44434 -233863 -645687 -562176 -269944 845993 642917 262616 285356 -793261 405441 542729 -573098 -713009 -87278 -25143 525862 -586275 -924252 -205744 286901 766491 717262 57089 747496 -312614 7667 -851747 -858620 -136568 546324 745749 -568177 387896 891456 77816 -900793 -643377 800756 968812 -778745 -832024 661677 430747 691900 -63791 -741557 623788 -931280 -189283 -497866 -83463 -243581 941009 791476 -55751 -882662 -936115 329651 255896 -188752 445138 201192 748563 265936 124814 722614 -12537 31…
Output: -8541927

Example 3:

Input: 3073 603 386875 -228015 -580547 -81912 -435999 715508 -628780 -539360 741768 742274 794330 867333 -50624 667862 948018 -868815 960621 200618 103897 -643246 -780528 -253181 -116369 -835413 -180530 -469368 -675094 487994 830780 531586 962374 545564 605076 575708 463768 -28368 -526931 -731458 219310 628692 44902 932149 -969774 343055 -259799 -625675 -467153 878338 851158 803063 -945293 -402377 -526302 7791 -92098 -489354 -207951 528498 250576 313500 158076 -240837 -496795 513144 841000 244452 619140 -721384 -345106 943939 -205055 289968 -654260 -878641 -749120 -202138 113529 474901 643514 -389035 -712996 535253 246064 365137 270210 255404 106183 -866848 441337 -309852 354844 155011 -859466 924258 -747560 -484850 -372300 -449186 806737 -859799 710058 -377740 152631 -924161 -408913 -190405 -832…
Output: -9732231

Constraints:

1 <= k <= n <= 3746; -1000000 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
The Calm Window of Ironvein - MEDIUM Coding Problem | CodeTikki