CT62669

Keeper's Peak per Window Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the garden city of Petalbrook. Keeper spreads the registers records across the table and picks up a sharp pencil. 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: 1145 229 848013673 -961400689 -785834629 -208332206 87608228 -122493043 -629772741 -996574525 -875335503 -619947379 538400773 -780721963 480905300 944620084 548278016 -861163664 839527752 720560882 -707745652 -271935876 460933755 -369662527 222976270 56937166 956736823 652604646 -94678993 462088857 -727105704 -979585017 280300486 -876839471 -8640070 908671288 171042840 497354633 434894291 335495628 -95462379 365461330 -872565199 239434964 -185588318 -634705411 616746980 -294354938 594842451 -147901826 254469841 -844319841 30901497 920546684 178681233 124085959 39147882 -855755724 -229836986 137972653 -298852609 -996465023 108190147 551126556 -893790660 748945015 920975054 -621436188 -662864185 -745351993 -769583890 483935240 -888133371 -300353840 772953322 -778262595 821445073 -711706511 -…
Output: 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 998967346 …

Example 2:

Input: 3962 2554 -278334047 296542200 -527440184 -475309163 72175492 -335122619 -299341856 -425589590 -743955613 825407427 459078022 -836776695 537958799 -885417802 -397445109 590823430 19843500 -940024668 -398228125 -445413051 -982271192 750047875 142595360 -774119196 545724321 849580823 -640486152 -982119479 731017104 -919565615 -522986141 489549714 -266433219 854427268 -7320053 -707234622 -48619387 -631456324 268151733 -73581882 991848554 -218067220 -630245058 -858395810 206542112 -350291433 228936843 -61272503 17392068 416802835 558639287 -786924098 -508232089 -648554702 -608527320 686231776 832445988 427652835 681285557 546601767 393571941 -412970481 449366228 -941610216 -16044409 -156998637 -308820648 -381735520 967789499 -97776865 174122224 -799918026 672305204 -416952326 205618664 -998723…
Output: 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 998861873 …

Example 3:

Input: 2856 2821 933659372 830548186 -57270998 -978070925 584303141 -391498986 514679266 403133157 256155678 -532435969 631591747 876496962 231497596 -747690120 -21420359 996265356 326127330 209047330 -29256190 -554506988 331962122 -925919591 -554385001 -119787742 151353080 -78229768 320645675 822250205 -475747951 94206287 -804095677 302571086 -268430572 957942702 716945096 685718246 538539463 -557665286 -448262509 472670147 533585168 139460560 469797749 -494865377 371215577 -988659585 387988331 -639392775 -341589051 -448879678 849217464 -833414902 -785837098 190247559 777567157 -285019394 -609953670 188840670 -316646688 633281845 -126874401 175641732 -69423095 -128012554 -302864104 -516556099 862790198 -638242565 577779943 -664644465 -572373970 903540036 427959963 -874169062 -134581429 -74278879…
Output: 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142 999894142

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Keeper's Peak per Window Ledger - MEDIUM Coding Problem | CodeTikki