CT39653

The Calm Window Beneath Leatherwick

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the tannery row of Leatherwick, Quill studies rows of panels entries. One clean number will settle the guild's oldest argument. 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 <= 3238; -1000000 <= a[i] <= 1000.

Example 1:

Input: 954 105 -35837 -343474 -968357 -678477 -346007 -262743 -338556 -621315 -13401 -479792 -756458 -331786 -229138 -779352 -922565 -987448 -824519 -468949 -977416 -395991 -556970 -403419 -947101 -483659 -729107 -493358 -853591 -74893 -806870 -404972 -737387 -835245 -602537 -490904 -685334 -461311 -172155 -341518 -701399 -549287 -371184 -796932 -997232 -357533 -710818 -315742 -396381 -807727 -377827 -426832 -599008 -99310 -984440 -108947 -17355 -819514 -362617 -746783 -72128 -376237 -747862 -740547 -381228 -322652 -36358 -68403 -834024 -634361 -556244 -827804 -763951 -785289 -817097 -928433 -311864 -473571 -574335 -353499 -66027 -991826 -796068 -778886 -816163 -585032 -785001 -815306 -110827 -599735 -321692 -882728 -377063 -585065 -168347 -130167 -280465 -507700 -988186 -726591 -255214 -394173 -…
Output: -57895470

Example 2:

Input: 1891 1511 -784586 -851759 -934234 -190646 -49895 -532651 -425824 -180655 -542141 -823103 -491723 -257087 -701074 -772775 -384205 -804560 -78336 -515484 -20587 -447461 -202001 -425846 -417222 -912995 -567811 -964582 -469720 -3658 -533891 -847983 -62961 -685584 -547211 -262119 -347748 -247576 -369195 -894236 -403688 -636892 -383854 -24685 -785016 -656524 -142912 -826473 -154513 -16975 -488541 -252748 -878457 -356756 -444009 -390249 -144385 -145195 -358412 -606782 -658549 -930608 -865533 -804351 -569999 -454977 -45073 -929924 -597540 -782841 -958957 -540244 -823847 -634106 -484159 -79099 -830296 -593937 -168933 -572215 -757114 -498612 -178323 -289906 -973104 -592347 -604834 -168656 -888336 -776964 -589970 -471782 -474353 -733807 -473612 -809792 -480177 -524039 -990915 -370199 -997742 -111252 …
Output: -769487093

Example 3:

Input: 425 160 -405222 -458409 -640729 -192456 -444847 -713913 -894661 -61649 -249804 -652618 696 -992697 -51490 -105091 -861523 -571111 -391493 -868142 -861248 -951828 -545000 -229886 -888859 -741604 -104210 -111851 -915952 -353063 -767579 -697991 -855826 -62475 -762100 -496119 -547541 -578173 -702238 -325105 -136276 -947941 -342127 -451533 -330929 -775179 -673 -481626 -164562 -197962 -38045 -763453 -632662 -341408 -836329 -372249 -601636 -281040 -806653 -251510 -223508 -489381 -82458 -960272 -899366 -784111 -735304 -253856 -133898 -715522 -794982 -135504 -298022 -917651 -649649 -183831 -973193 -372592 -921378 -10934 -363402 -18118 -946980 -868584 -598303 -749421 -909585 -112757 -991445 -772177 -542102 -254780 -209058 -562124 -598555 -812992 -693883 -862507 -772678 -437632 -687818 -968839 -36244…
Output: -93490592

Constraints:

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

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