CT47878

The Peak per Window of the Ancient ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the mushroom groves of Fungaldeep as Indu unrolls the day's manifest of ledgers. The tally will decide the next shipment. Task: For every contiguous window of length k, print the maximum. Input format: First line: n and k. Second line: n integers. Output format: Print n-k+1 maxima space-separated. Constraints: 1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 2500 1273 -453161854 200555155 -661555972 -834108588 -317588550 -488612609 369072531 -294365540 -849174346 -239299100 -644375017 -556506778 -56540643 446308084 -476710675 670395119 696961939 890751314 7851608 -149926619 -502420863 295388796 -986677250 -467970660 -483473868 842614748 -674246346 161651852 847368156 -506378165 -426433574 -161997763 77196711 -176762600 112096977 -56365471 47140227 -155494961 -275918243 182997741 400029263 147119208 50975223 -635602093 686036137 -348363727 -105404850 -555013228 -968311813 -768140975 249748649 581415335 443386038 69862803 -256627468 383109773 683035822 -396669095 -134757071 799138729 437132202 -839828210 -903193948 495876326 -729965950 432123116 -168144117 -664430404 -398544504 -248671635 209595939 241320017 -737811018 -96820371 28881876 1761099…
Output: 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 999297905 …

Example 2:

Input: 13 8 -632997560 -49480690 -744157702 -762645477 -840976976 981336268 -84218679 -485496228 756529994 -105681377 -567567993 -64991500 765973239
Output: 981336268 981336268 981336268 981336268 981336268 981336268

Example 3:

Input: 2132 917 552148666 171532394 -312963638 -96488508 718192438 134671149 372141602 -897390833 -841654743 -357327706 -907695657 -763707305 47246318 768813782 -674363708 344351659 833200732 815911509 203677195 219058965 -761725202 -306794953 422269328 -476737669 -572700317 316010227 182449144 531287086 907046972 321196805 -660765655 40034205 270599586 -355582173 911839487 661853850 455563895 349531773 -238864891 43168633 -267922484 -84964676 -750470215 -97944774 722805484 951894063 -13971241 319496354 734612378 -107018180 13374342 407405885 -402643840 -320403279 192854808 414435349 564185191 754916351 144695422 -337198105 -976557897 473023960 13593233 -904287870 92574165 -859035153 -748265440 -920995283 -812252512 159737953 428975688 -154710005 -949523662 -348060038 628250 -62810470 -696163260 …
Output: 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 998525309 …

Constraints:

1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.

Loading...
Test Cases:No test cases
No test cases available.
The Peak per Window of the Ancient ledgers - MEDIUM Coding Problem | CodeTikki