CT52732

The Whitestone Fixed Window Peak

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Brevin inherited the exchange at the alabaster quarry of Whitestone along with its curious bookkeeping system for segments. Time to make sense of it. Task: Print the maximum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the maximum window sum. Constraints: 1 <= k <= n <= 3680; 0 <= a[i] <= 1000000000.

Example 1:

Input: 1383 92 776227299 499673181 437923004 474904698 316664893 316843213 378349531 396009499 505569695 302640083 736674344 19232131 258506595 336979658 789704024 232258492 336674224 569843645 416302105 145076596 239327027 655508485 135827287 552578397 998577354 548320759 852662731 436466793 658826560 442766782 794903867 318621318 509032233 135358456 18777646 714797169 736472428 518733993 54030746 255374783 598285131 576583851 38639057 725253028 50750740 270527143 761879447 883830034 726180972 948936367 810394570 223273717 162087274 711578324 60310902 802410566 703486085 353521430 414211296 922424971 105081323 715892574 268640165 694374510 427925663 288389398 794075893 837249155 881717289 963796096 873087867 97703461 14859896 79455443 203129391 201935412 648950268 679190241 433805119 286176978 2…
Output: 51218304296

Example 2:

Input: 2622 1745 165567063 971455213 632038521 7156926 373256094 506045218 213433475 634732514 44785558 526459207 956041284 901827394 885930490 267388415 141463717 437239379 719138034 886323190 50121252 37267185 456198918 448448005 142377981 490154388 89652754 307036256 700146921 432420229 228708679 453323812 995461228 874621453 799963401 681591098 752280990 653642519 644091946 246487134 222251390 393049595 736891192 264641551 974873104 690749145 612384400 353394073 884610793 976268165 790204711 653273181 941473030 966649326 185436755 32602826 135504244 186562722 131242247 417094339 539321694 533962979 476802466 977764091 948941500 190492677 883696991 107631835 803673099 170096793 972871598 627599666 779517368 832295147 687810016 804450825 439441734 603111345 91309724 558855757 629332283 35434792…
Output: 880521997496

Example 3:

Input: 3466 2528 724269319 367149739 174455913 218170549 109621816 472803591 93241341 350637332 803847674 546821701 50977298 724883358 482586015 134717268 599378318 269040072 277999139 874577729 919236227 452971069 798209406 859906934 105206013 124631738 915487376 351461912 558900886 417806715 488017723 30058783 87665510 206301516 843021353 45058513 319807973 135117612 113693998 108319563 547038006 862485410 538435563 59951269 456984217 910054358 887339570 725287500 712019582 373509650 440447098 589357427 100656532 272218283 661305619 796742935 855478659 336204562 536616658 553613365 11389233 11569317 7241830 76727219 608368797 680459542 347887271 983122934 292469418 51050746 25928310 426934764 550621106 921416222 292060554 957689152 247198791 655823353 670811803 803281296 195623925 348747886 492…
Output: 1274320849304

Constraints:

1 <= k <= n <= 3680; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
The Whitestone Fixed Window Peak - MEDIUM Coding Problem | CodeTikki