-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathchallenge.html
More file actions
35 lines (31 loc) · 1.09 KB
/
challenge.html
File metadata and controls
35 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<p>
Implement a program that computes the maximum sum of any contiguous 2D subarray of length exactly <code>window_size x window_size</code>. You are given an array <code>input</code> of length <code>N x N</code> consisting of 32-bit signed integers, and an integer <code>window_size</code>.
</p>
<h2>Implementation Requirements</h2>
<ul>
<li>Use only native features (external libraries are not permitted)</li>
<li>The <code>solve</code> function signature must remain unchanged</li>
<li>The final result must be stored in the <code>output</code> variable</li>
</ul>
<h2>Example 1:</h2>
<pre>
Input: input = [[1, 2, 3],
[4, 5, 1],
[5, 1, 7]]
window_size = 2
Output: output = 15
</pre>
<h2>Example 2:</h2>
<pre>
Input: input = [[-1, -2, -3],
[-4, -5, -1],
[-5, -1, -7]]
window_size = 2
Output: output = -11
</pre>
<h2>Constraints</h2>
<ul>
<li>1 ≤ <code>N</code> ≤ 5,000</li>
<li>-10 ≤ <code>input[i]</code> ≤ 10</li>
<li>1 ≤ <code>window_size</code> ≤ <code>N</code></li>
</ul>