CT37184

Bright scrolls Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the shale slopes of Greystone opens only for a perfect tally of scrolls. Isha means to find out. 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 <= 3067; -1000000 <= a[i] <= 1000.

Example 1:

Input: 452 8 -398263 -99735 -948015 -17020 -905288 -86946 -822124 -869935 -221193 -930771 -660463 -293659 -625166 -988191 -663478 -467384 -130569 -382302 -707946 -44727 -823961 -203847 -643670 -941859 -90490 -972113 -967940 -285538 -863968 -528309 -124622 -424030 -387394 -760605 -735243 -865676 -560528 -280913 -582624 -974448 -475922 -92999 -630541 -974745 -624301 -836468 -94717 -684655 -159465 -488450 -680711 -415832 -46128 -951434 -230518 -408595 -24356 -359523 -974555 -156494 -848628 -85419 -755886 -147611 -645628 -912437 -298412 -506114 -45857 -71571 -158143 -283017 -489037 -979693 -823189 -592073 -574447 -682962 -287555 -922584 -995800 -570230 -6549 -297369 -35175 -273866 -182665 -35669 -770713 -589586 -433757 -576749 -260763 -584947 -959131 -733113 -793298 -676780 -890504 -264991 -237807 -4…
Output: -5897793

Example 2:

Input: 1526 48 -320146 -918186 -885503 -622558 -763881 -463487 -735474 -696680 -20768 -922121 -317109 -902655 -957709 -279282 -52075 -276669 -378499 -474142 -425098 -802259 -639835 -95081 -7098 -588937 -396359 -483887 -855436 -366285 -7868 -860553 -821127 -757431 -985970 -757495 -817681 -879896 -750562 -909347 -392328 -349206 -957748 -90421 -354258 -795159 -25500 -695913 -314504 -966972 -109315 -729489 -769020 -192420 -704101 -441742 -379267 -429745 -412049 -32746 -907590 -686537 -438261 -837858 -838508 -333534 -206843 -388602 -615712 -287311 -995166 -796380 -789371 -138547 -718093 -582528 -119094 -291067 -176890 -158457 -57735 -162730 -757540 -617547 -331904 -579783 -31243 -989491 -831472 -208147 -680804 -142423 -19471 -695505 -345624 -231221 -760997 -319090 -803677 -15715 -768189 -23607 -610869…
Output: -29394508

Example 3:

Input: 357 107 -868987 -450818 -523397 -698153 -58253 -512293 -694170 -527708 -586409 -132680 -852773 -757232 -213824 -933792 -902032 -217945 -924594 -431493 -794614 -80646 -977499 -450733 -108181 -294930 -344369 -381437 -889566 -115834 -131510 -990010 -399679 -656434 -959165 918 -465599 -541780 -74490 -860457 -217924 -249057 -583000 -374670 -837194 -924765 -476830 -793196 -22447 -618878 -100324 -237995 -775116 -305868 -432825 -574167 -713111 -891645 -628019 -748455 -668423 -787181 -28248 -704801 -970197 -559334 -869891 -479006 -127783 -231734 -242011 -680115 -959507 -295902 -69758 -675879 -330265 -776901 -243096 -846661 -781544 -960746 -156677 -355044 -473214 -810493 -341132 -169630 -736184 -741797 -964124 -736964 -51401 -225302 -604553 -182412 -932263 -464898 -208428 -982924 -317608 -830548 -96…
Output: -58544346

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Bright scrolls Calm Window - MEDIUM Coding Problem | CodeTikki