CT34100

Peculiar segments Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the frontier camp of Duskwood, Omkar studies rows of segments 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 <= 1865; -1000000 <= a[i] <= 1000.

Example 1:

Input: 1695 1070 -633446 -379942 -856295 -259529 -606151 -221470 -467872 -602828 -57552 -336529 -839536 -565698 -324291 -157166 -25388 -647985 -55326 -216656 -661920 -883325 -711593 -597633 -891944 -963339 -207447 -287916 -149303 -827371 -637211 -684619 -621210 -784820 -156884 -450338 -771205 -609760 -429842 -924909 -754251 -48354 -377033 -355823 -252768 -953799 -45061 -378134 -374599 -933948 -629598 -466168 -773629 -981255 -733635 -372054 -867223 -991351 -327315 -855273 -921447 -363820 -544676 -375693 -712563 -841865 -326565 -56334 -834522 -448032 -80552 -324114 -530170 -274595 -56678 -589553 -665007 -926053 -938993 -478023 -514668 -452399 -516598 -343716 -629693 -33948 -85533 -322869 -642363 -884678 -744397 -247505 -951235 -296307 -200968 -316230 -933527 -567538 -659947 -974092 -451060 -115922 …
Output: -540155267

Example 2:

Input: 1208 778 -471193 -296541 -473919 -273508 -471620 -748979 -538120 -161102 -444571 -429270 -81493 -874870 -225772 -549224 -218243 -674327 -87507 -516058 -368841 -653964 -921341 -162293 -920953 -581645 -76531 -96571 -105085 -601657 -699766 -26091 -855347 -889359 -572224 -193745 -175792 -3060 -424570 -95702 -174528 -44818 -496329 -471596 -698066 -777892 -734450 -129983 -4342 -487071 -828506 -75544 -635415 -299026 -814078 -510031 -397060 -141515 -365736 -856807 -46201 -206973 -647343 -323526 -33247 -598915 -418458 -524313 -916869 -450057 -735333 -769191 -499476 -84931 -259555 -310610 -263148 -997301 -249717 -880123 -60660 -656143 -414468 -789851 -940115 -146589 -889353 -439409 -551666 -181366 -466499 -371524 -927017 -194565 -901031 -633577 -974809 -24927 -326644 -822157 -135172 -183872 -677462 …
Output: -387610814

Example 3:

Input: 924 509 -286 -256953 -596644 -842494 -755405 -282445 -428469 -313016 -13514 -394066 -816025 -283993 -132684 -834790 -863920 -586508 -117171 -40870 -828566 -713006 -92997 -951792 -706506 -120277 -985564 -755141 -357671 -1490 -600015 -19896 -336867 -325109 -638677 -482300 -576191 -813307 -969808 -922769 -49088 -692722 -71299 -499564 -66197 -862483 -311227 -247031 -894124 -214772 -903987 -628929 -620123 -698521 -859855 -406332 -61887 -887072 -604902 -535741 -662300 -996389 -22517 -431180 -530941 -545186 -765265 -400889 -59863 -484455 -618168 -661230 -904978 -314140 -30469 -215302 -624066 -186610 -617871 -493995 -519664 -933248 -936076 -431531 -117307 -746767 -106691 -343373 -982298 -402746 -814944 -15558 -174349 -215928 -597334 -95582 -825888 -430547 -707688 -70664 -281785 -806375 -264451 -92…
Output: -262030836

Constraints:

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

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