CT37162

The Pearl stretches of Kate

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Kate inherited the kitchen at the canyon post of Redrock along with its curious bookkeeping system for stretches. Time to make sense of it. 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 <= 3024; -1000000 <= a[i] <= 1000.

Example 1:

Input: 451 246 -100049 -71041 -485501 -852884 -189547 -222973 -730082 -901100 -909207 -11931 -638168 -269509 -179170 -839249 -818698 -299811 -232893 -996808 -634839 -268144 -444857 -882503 -315210 -232015 -26627 -679030 -128534 -292112 -618618 -191724 -820823 -608689 -953721 -881719 -590194 -901685 -267741 -860733 -826625 -707406 -910051 -321304 -694888 -931556 -253616 -174150 -191836 -791200 -693487 -988369 -811510 -904622 -959318 -879810 -616416 -672163 -100802 -199327 -961422 -41522 -96647 -668222 -613342 -505666 -721637 -340067 -175199 -20937 -851309 -482198 -891104 -550296 -798027 -855445 -231405 -618734 -692914 -999647 -449161 -24006 -53175 -423291 -753022 -879096 -23121 -202361 -970588 -460791 -564182 -490697 -273110 -220749 -421383 -592112 -769368 -380318 -387797 -52793 -764644 -411748 -7…
Output: -131389386

Example 2:

Input: 2775 577 -606925 -416017 -475009 -981896 -169952 -890885 -815023 -374149 -154323 -570405 -483389 -777070 -753742 -186389 -384399 -783634 -898194 -342588 -594595 -1284 -452275 -582584 -855742 -901537 -236985 -816404 -77238 -80934 -929282 -315752 -541087 -441226 -43521 -633622 -741450 -24230 -341593 -951358 -437138 -342340 -930782 -510187 -351277 -777561 -180172 -960269 -70458 -927622 -48581 -62987 -340150 -355498 -173341 -497227 -974610 -849534 -875691 -689737 -558479 -640396 -918646 -510081 -404980 -623930 -309429 -96178 -893638 -198317 -302392 -616642 -468685 -33403 -567173 -630666 -247516 -144730 -243628 -578179 -145295 -185408 -827941 -363945 -762447 -901552 -269121 -134913 -620369 -340487 -328515 -129438 -644380 -65974 -200948 -102937 -633593 -769030 -270143 -288490 -578959 -127931 -65…
Output: -303710980

Example 3:

Input: 714 64 -672534 -851069 -437172 -219084 -64901 -231773 -511023 -304904 -45615 -28874 -912705 -563107 -392818 -144708 -762992 -111753 -502733 -873814 -178545 -759268 -16710 -356794 -742135 -851312 -302384 -334141 -842603 -873612 -143242 -508431 -972068 -894563 -444127 -287085 -348223 -20869 -719896 -543635 -777018 -11933 -242097 -140587 -782270 -905031 -10008 -948155 -96902 -996083 -842353 -72653 -301372 -238901 -81970 -343428 -587047 -160587 -646506 -977987 -909408 -907131 -420776 -457272 -371391 -753009 -108225 -676839 -345708 -843307 -387432 -526664 -727065 -541350 -72298 -190024 -89883 -890190 -940630 -526066 -812180 -474749 -642911 -829815 -113838 -243696 -962903 -163436 -12934 -435111 -447528 -154056 -31998 -837219 -292626 -178444 -76904 -912167 -309824 -504112 -906766 -777876 -247483 …
Output: -37071355

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Pearl stretches of Kate - MEDIUM Coding Problem | CodeTikki