CT50428

The Peak per Window of Bloomglass

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the orchid house of Bloomglass, someone must forecast next month's demand. This year the task falls to Maya, armed only with the beacons register. 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: 19 15 -353583146 -135636239 642159958 806385493 -673634246 -878269274 491222942 -501514955 402389563 -560620543 629848119 442961254 -161212801 455727392 29455566 582600916 48026918 -785029383 -578170157
Output: 806385493 806385493 806385493 806385493 629848119

Example 2:

Input: 1728 853 86008272 965403524 341740087 -791232027 735358925 -359873835 273794317 -361727269 -123871164 463966093 -163362101 -846673456 -606946402 -51109868 112356520 -614989158 -978300229 728647900 712301785 694312961 58037724 810555421 825564294 -14559268 395941861 204293582 380627476 -897529162 230427696 -713821027 963907039 925301866 138494387 124691546 361504162 -257387975 -300186012 182653927 97608875 669315409 -851389382 992290505 829095673 431345368 -464646693 -105355924 789453389 -533493914 -525528718 600070616 741153825 117062938 972579152 -351298942 696809676 -788370073 -994664364 637186037 463627553 -161029506 498917180 -344811043 651392609 -933537946 66182443 -43218734 -260959141 82934495 443193488 442744346 -587579352 691769978 -932233244 709141796 -723717476 -938739534 -636974…
Output: 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 994670916 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 999400029 …

Example 3:

Input: 3922 1827 951670569 300957952 -49663120 -142739436 -755378905 -425867067 -319846367 29374017 151388397 -223544798 823672547 -627710473 -276845712 -495249819 -684392484 -835258373 -824353126 -321781002 -363877109 -552943621 782453957 -64452485 214974064 246651862 790433955 567957829 235847427 605057806 -184019734 -123011808 605716727 -58873332 -570926814 750846496 -463611274 871319392 -325939336 428073991 -142180787 475891188 -871047216 512373652 -382967877 -198683960 -381112155 -102540638 619165085 -695056524 950267981 503069927 132754337 -698799123 64901022 -364577528 -866293394 -556981773 -951080738 -8795774 326569009 625132112 -755429038 539988970 -16616144 -765936280 -787141167 -268810781 -258228832 723098762 -138611321 351674264 -841817231 -176564334 -35171146 -855615804 -492379160 99…
Output: 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 998912123 …

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 Bloomglass - MEDIUM Coding Problem | CodeTikki