CT54108

Squire's windows Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the zephyr cliffs of Galeholm as Squire unrolls the day's manifest of windows. The tally will decide the next shipment. 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 <= 1287; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1117 1030 939937 330819 863205 -442675 -892058 904311 -341362 -116498 391231 -402198 286814 452986 965025 -424969 -645485 493013 -678008 982623 -238403 110077 210088 -186753 -16396 88950 -946584 843133 -103120 -228341 241566 164765 -683867 892505 527331 -330800 943334 953042 995186 915051 -219584 501196 -983470 371504 681258 442352 646244 464741 438429 79129 -865700 -911821 933216 118001 -434036 880968 409449 437973 5784 -553193 -477214 13662 497829 -462291 -907727 363455 861877 357185 369919 604063 662061 -116614 -348238 335285 -837533 994401 -264016 -464284 209625 976543 374125 -29920 207833 -188345 386247 -185597 -174543 722445 105450 -106843 -345493 434716 -385521 -237638 750093 -886331 -275215 510344 95649 759197 -266771 839174 -207264 589751 -143794 87364 -433003 582189 647356 -58759…
Output: 2227619

Example 2:

Input: 1090 358 -364628 813905 25257 -695823 -551725 199089 342670 -166980 -54793 -679743 -542423 -845241 -212424 63337 -791330 -221383 -972352 855590 -30384 867884 427155 -226469 235443 -688453 -74724 -158584 958707 682667 -688521 886865 372812 198174 -137258 -782457 -814008 -35359 -530075 45737 -655235 -453775 299157 -162664 -858969 335298 -145020 795591 -849058 745514 -849524 -118202 122538 123470 952426 319630 -90142 351885 -823891 -284710 -716423 -256201 -922905 115065 614959 836929 -628422 -46223 -519234 -266542 -231696 529206 893194 -806978 241017 900125 268800 626166 670305 144272 -721379 7080 -862401 -877859 -924032 83004 900804 373762 158429 758946 -890321 -606528 -975371 734954 -280915 254515 84451 94562 517801 -470125 672520 800380 453157 -223408 178689 -420225 -844564 217460 -882926 …
Output: -21298949

Example 3:

Input: 57 12 406657 -433893 74139 349266 -722196 -931369 955355 -88418 -847051 112658 -379526 -337846 -404634 157725 443383 -258716 -574990 269802 384448 962656 -176058 309234 -349329 -408203 -112223 -210108 813988 93544 -828965 172845 -69947 313943 -188474 335441 879619 182814 214285 -211946 -718067 575192 -146165 -823213 -53639 719480 -646612 -385698 -523652 -74122 -643655 502942 707449 -825186 -743921 -496516 -831742 149845 681609
Output: -3810868

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Squire's windows Reckoning - MEDIUM Coding Problem | CodeTikki