CT52238

Faye's Ledger of panels

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the zephyr cliffs of Galeholm, someone must price the new merchandise line. This year the task falls to Faye, armed only with the panels register. 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 <= 2274; -1000000 <= a[i] <= 1000.

Example 1:

Input: 894 690 -475925 -841361 -122820 -714692 -584232 -882609 -981377 -259944 -927613 -38176 -359194 -223229 -956551 -123949 -155347 -629535 -403133 -36117 -36033 -730682 -205584 -774196 -473909 -620050 -125757 -231101 -206211 -284218 -426371 -357616 -976804 -157736 -243113 -375234 -906086 -14684 -98866 -578793 -336358 -789713 -877175 -131317 -232109 -877604 -836747 -651882 -572252 -587388 -699110 -441598 -175214 -667150 -12010 -38707 -531882 -236153 -328533 -735467 -994591 -23519 -413930 -876385 -596311 -571795 -153363 -610339 -972788 -855120 -463315 -388033 -234293 -182058 -486721 -29330 -771003 -955317 -736 -371147 -190057 -384428 -585783 -535435 -859300 -487080 -823661 -638615 -203101 -532963 -611316 -821350 -991453 -614038 -999358 -65589 -598939 -108553 -243374 -224378 -745639 -783911 -5383…
Output: -340802258

Example 2:

Input: 707 407 -894593 -511839 -773071 -410705 -618519 -766914 -318048 -908299 -51286 -511423 -244153 -671090 -13409 -677940 -150330 -622036 -65541 -291270 -2450 -33839 -130900 -150699 -729049 -58314 -642989 -770467 -813796 -670484 -850259 -58710 -958736 -933710 -87516 -694251 -587936 -97583 -720589 -396867 -297939 -632998 -396180 -745301 -210591 -570992 -196868 -578032 -888701 -231618 -233709 -109464 -194187 -610782 -509740 -87899 -180495 -88725 -988643 -82464 -664834 -837497 -632113 -891552 -876092 -888028 -187554 -361376 -565692 -891164 -729955 -693628 -9609 -162526 -979435 -861087 -623585 -349123 -388879 -593921 -203046 -677096 -881568 -318012 -639191 -395816 -811389 -134546 -500797 -216312 -547869 -119190 -310176 -266401 -594072 -682226 -508749 -483802 -513277 -739156 -2820 -812463 -751008 -…
Output: -206981844

Example 3:

Input: 2077 1212 -705934 -65645 -881048 -278083 -547772 -9696 -299919 -261582 -913662 -42502 -145165 -609424 -211542 -22491 -542704 -467313 -771875 -43724 -573703 -551341 -330400 -40831 -580046 -915464 -538406 -43178 -315581 -484912 -461516 -503638 -648660 -204801 -48766 -781150 -582852 -408175 -347733 -508362 -32141 -117019 -485145 -643666 -377326 -531138 -730327 -539047 -663469 -104626 -635082 -756537 -495857 -931723 -472602 -928922 -184439 -304077 -189250 -304420 -263620 -13685 -139886 -705311 -272027 -478670 -124218 -35013 -782215 -668016 -312333 -474391 -850469 -811476 -217712 -943306 -972596 -443114 -236014 -653527 -28629 -437518 -224819 -889024 -231727 -870459 -818685 -952056 -705487 -883909 -608018 -497144 -110601 -795259 -203251 -266217 -143297 -878173 -673443 -472636 -942496 -982597 -76…
Output: -616378475

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Faye's Ledger of panels - MEDIUM Coding Problem | CodeTikki