CT34410

Zane's Calm Window Ledger

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The harbor bell rings at the beacon hill of Lantern Tor; Zane weighs the day's segments manifests and starts the calculations. 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 <= 3942; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1885 1546 653221 -897053 395784 -444635 -488501 -625068 238126 -982820 649181 -44811 -859793 955492 747819 432482 350743 54639 564990 -730324 679795 265227 -284386 132182 -487940 634803 593492 -683976 -613602 -288909 446924 408337 -90354 -180155 558200 -475506 -741980 40759 -14638 170361 -34426 130632 361265 -797270 -178761 840247 627163 -463288 -499645 -926510 -220345 552122 331968 817679 120573 -35790 -667585 507475 -277420 -58419 894611 -744622 -55489 -877422 -117634 -531922 -892007 11337 -408619 -741886 -372817 -719188 523878 391081 795106 571522 48542 32752 824903 489579 -620367 -573374 -274130 -399720 276452 979050 -328847 753740 -253732 551268 -344299 839469 879309 -979381 203179 278342 696963 -825430 -555426 588902 438958 638463 -671339 41660 467091 -697449 -965967 -191498 -24951 -…
Output: 3418602

Example 2:

Input: 192 56 -366834 57224 -291694 -232898 336499 -445087 -667675 -587905 746594 -688026 -971682 255006 289651 898101 -347906 -721572 -92561 -94758 -732751 -101621 893640 -360111 896962 -600735 204697 342943 -774736 114679 -485737 538543 543742 450317 -882392 -608131 689279 -773809 218970 437492 373959 -935821 122840 429821 252708 418282 -659934 -97182 -612859 -69830 -607294 665560 -710806 893413 278268 102487 -422207 754773 -487193 -292067 -396048 636860 26280 150165 726195 -803175 284810 621267 988299 402191 611351 -116567 -813995 814563 234234 239428 -450894 387903 595501 -347669 -581039 276165 -202879 112694 193469 135317 -422476 -866181 286435 -227517 -959236 -932414 635835 252177 164255 -660484 119163 -278591 -188867 233049 -843482 684074 -589343 -497610 547326 700584 768601 -374746 641558…
Output: -10043435

Example 3:

Input: 2730 2461 725580 999476 -645265 -761449 -114722 253252 -530927 -235645 162820 -155626 -977626 956478 -401971 162145 589259 -383873 -651918 -706614 -601733 430802 -415749 123199 629894 375852 850895 -801653 -388482 258173 728188 -256097 -928913 -767145 -316478 135250 186339 967092 116035 -442934 -859717 -235969 134810 359571 723484 89563 -497437 172988 -359560 -898826 -607127 -181975 903885 -634645 -239918 457883 -570585 -31306 -968006 -244401 -857006 582344 338135 -331364 701077 -720355 491136 -609820 74359 281822 313382 500509 797757 -933412 727120 -255699 -171246 -227091 -156880 -746137 -662476 -64982 111961 -147538 -582981 -835880 85608 -507654 -345643 -124127 -99536 680214 -654638 -767244 691754 452321 -949828 -347460 460328 49700 646090 620916 -706102 745493 -661390 -33222 -696535 168…
Output: 12017972

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Zane's Calm Window Ledger - MEDIUM Coding Problem | CodeTikki