Skip to content

Commit 5a45ba1

Browse files
committed
Create README - LeetHub
1 parent 4bc1414 commit 5a45ba1

File tree

1 file changed

+48
-0
lines changed
  • 3381-maximum-subarray-sum-with-length-divisible-by-k

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<h2><a href="https://leetcode.com/problems/maximum-subarray-sum-with-length-divisible-by-k/description/?envType=daily-question&envId=2025-11-27">3653. Maximum Subarray Sum With Length Divisible by K</a></h2><h3>Medium</h3><hr><p>You are given an array of integers <code>nums</code> and an integer <code>k</code>.</p>
2+
3+
<p>Return the <strong>maximum</strong> sum of a <span data-keyword="subarray-nonempty">subarray</span> of <code>nums</code>, such that the size of the subarray is <strong>divisible</strong> by <code>k</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<div class="example-block">
9+
<p><strong>Input:</strong> <span class="example-io">nums = [1,2], k = 1</span></p>
10+
11+
<p><strong>Output:</strong> <span class="example-io">3</span></p>
12+
13+
<p><strong>Explanation:</strong></p>
14+
15+
<p>The subarray <code>[1, 2]</code> with sum 3 has length equal to 2 which is divisible by 1.</p>
16+
</div>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<div class="example-block">
21+
<p><strong>Input:</strong> <span class="example-io">nums = [-1,-2,-3,-4,-5], k = 4</span></p>
22+
23+
<p><strong>Output:</strong> <span class="example-io">-10</span></p>
24+
25+
<p><strong>Explanation:</strong></p>
26+
27+
<p>The maximum sum subarray is <code>[-1, -2, -3, -4]</code> which has length equal to 4 which is divisible by 4.</p>
28+
</div>
29+
30+
<p><strong class="example">Example 3:</strong></p>
31+
32+
<div class="example-block">
33+
<p><strong>Input:</strong> <span class="example-io">nums = [-5,1,2,-3,4], k = 2</span></p>
34+
35+
<p><strong>Output:</strong> <span class="example-io">4</span></p>
36+
37+
<p><strong>Explanation:</strong></p>
38+
39+
<p>The maximum sum subarray is <code>[1, 2, -3, 4]</code> which has length equal to 4 which is divisible by 2.</p>
40+
</div>
41+
42+
<p>&nbsp;</p>
43+
<p><strong>Constraints:</strong></p>
44+
45+
<ul>
46+
<li><code>1 &lt;= k &lt;= nums.length &lt;= 2 * 10<sup>5</sup></code></li>
47+
<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
48+
</ul>

0 commit comments

Comments
 (0)