CT56315

Lara's Ivory Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the tundra station of Whitesnow pays by the answer, and Lara intends to earn it. First: the full register of panels. 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 <= 2785; -1000000 <= a[i] <= 1000.

Example 1:

Input: 1308 990 -908497 -220677 -394389 -881186 -247799 -576778 -64619 -221980 -423387 -789894 -798903 -719012 -650116 -141725 -301200 -966344 -689856 -689335 -624638 -474777 -380518 -508119 -599097 -562771 -626926 -993554 -989664 -268080 -333388 -704597 -974757 -916496 -534318 -492656 -522523 -298254 -333305 -468944 -459903 -566271 -682153 -792263 -281877 -655509 -930140 -542131 -646204 -121546 -986465 -418327 -954143 -156351 -341760 -191522 -939090 -714460 -532084 -234411 -928175 -101517 -196569 -375317 -981007 -898486 -65695 -349364 -85502 -3574 -746682 -350569 -591988 -894970 -542363 -621503 -701133 -794743 -39099 -283610 -258100 -782152 -898981 -758204 -913014 -757784 -605395 -613097 -68769 -364931 -657953 -114713 -262413 -346653 -307854 -384439 -237380 -114988 -379199 -826613 -868850 -69020…
Output: -511032464

Example 2:

Input: 306 121 -339194 -446303 -79264 -943220 -550310 -997819 -804416 -980026 -202298 -136870 -216719 -640700 -331486 -656474 -545369 -415387 -271935 -721873 -572424 -795449 -487473 -763656 -145051 -16880 -371013 -80052 -399196 -788182 -619478 -235728 -96920 -520359 -176789 -116412 -504015 -819308 -952972 -606864 -975659 -806530 -170179 -829539 -615311 -500354 -513537 -118342 -296016 -209609 -907874 -569144 -391803 -404336 -683520 -704154 -685266 -970196 -962861 -924418 -928428 -766724 -393247 -632985 -182082 -847115 -61384 -45663 -610338 -379034 -454879 -674906 -107303 -468879 -691553 -336927 -136442 -922486 -578493 -709015 -477252 -837485 -727227 -507593 -952950 -421140 -844069 -896723 -686158 -493822 -817589 -304720 -18282 -206131 -484358 -159578 -459499 -836674 -612479 -446326 -516798 -840836…
Output: -65603237

Example 3:

Input: 1071 831 -630440 -7729 -103667 -68990 -2870 -462493 -615620 -31683 -375958 -747221 -901457 -651978 -28394 -394995 -890589 -254703 -398837 -64056 -824858 -241353 -370342 -353353 -759705 -57815 -274686 -621424 -16618 -277913 -682388 -831625 -882733 -61541 -855422 -565171 -129912 -203653 -337483 -645782 -773880 -368029 -371255 -296366 -82264 -905015 -269482 -592061 -821036 -245050 -865467 -331960 -985195 -96665 -215689 -201689 -632450 -521105 -188824 -900907 -736995 -918932 -990278 -99670 -619353 -870674 -429324 -679326 -946261 -564762 -91324 -960040 -622301 -167400 -315172 -334584 -584738 -795193 -735548 -558502 -189615 -648110 -630287 -762901 -658847 -112924 -544884 -597749 -859290 -658866 -973845 -941123 -254383 -66552 -954896 -727541 -48169 -307795 -644713 -610447 -701888 -831092 -389027 …
Output: -420439462

Constraints:

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

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