CT40092

Bishop's Bronze scrolls

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the savanna camp of Amberplain, Bishop studies rows of scrolls entries. One clean number will settle the guild's oldest argument. 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 <= 2315; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1854 313 493140 711581 613695 398997 563828 560931 858968 493415 -415625 411633 -964931 -248801 -305004 101908 32748 -980050 376274 142258 -768426 -769525 349155 551429 -478785 -7549 913403 920177 -746194 -491388 -986199 243108 -241600 -541263 -463816 372377 -171695 887849 -720485 198438 145502 552630 736505 -599051 -523201 -149946 385028 505242 627499 -453368 -415469 785374 790491 -95288 -231149 -142623 -682275 975351 -991203 970833 469062 496650 106176 -345593 -114978 -461989 -584860 356090 753434 -406188 394760 -379431 207679 -748086 777772 -67489 168522 22202 687986 580804 -807006 -646034 -884805 529972 -427604 69080 -868817 -30713 654120 -512263 -318460 -903234 403494 260486 161027 -241673 -606946 -773904 -57735 994147 378920 -130046 -418686 268993 -207317 -494702 -641740 936511 -5394…
Output: -17853503

Example 2:

Input: 1226 311 458448 -219302 -521231 576572 -957830 628738 284265 944445 -957711 -614004 829415 -217294 579962 -67216 803078 491988 -340107 30568 -26793 -829620 -394835 -265011 54363 -793518 -952531 158930 776593 782372 -533451 454815 702552 809042 -706035 309568 907985 -101748 -458178 -260104 797850 -47554 957196 907986 84460 -108609 -588466 353235 462155 462688 -356682 -212224 717149 -975039 629323 883492 -282061 -533680 -743875 143071 364780 -68661 487311 558831 -36179 -824621 322671 876457 796712 -351763 87272 386294 432972 353822 53211 641027 -465555 26360 -179369 -254544 -871249 947954 123637 799352 702939 200809 257935 65739 -260342 -313372 940937 -865896 387081 -25550 211483 200533 118637 66766 -700988 936201 389349 784225 -128834 624788 895633 985129 381938 -630235 524899 649568 564770…
Output: -15517072

Example 3:

Input: 1248 774 -326647 -706629 -163155 -856688 -194107 -702638 -63470 -453170 -416405 -735206 691686 844231 587036 -402629 -818553 -156021 -798616 -914483 -556347 117638 489063 -438417 -7122 -648389 551154 340044 -989139 972878 -474726 953521 -933872 824703 -707450 -662933 312215 334853 -752113 -643930 691168 -813796 -391159 744149 136076 -692865 411787 -479334 996701 935707 -457948 -588749 -345129 -319355 -366958 840350 -985077 -998639 -372127 -796860 632674 -405889 -510657 999815 215061 -620740 696329 -176785 403707 -976174 333856 357969 706767 -367442 -878559 -529644 95279 -619702 984030 169884 641763 990685 -894142 -556312 -990944 -281841 -493328 -738527 -640433 -934607 -489854 -985985 84114 29225 586346 365376 55554 689650 -427396 971210 844382 -143298 -779703 791699 -683250 850427 968757 -…
Output: -28806490

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Bishop's Bronze scrolls - MEDIUM Coding Problem | CodeTikki