#3381

Maximum Subarray Sum With Length Divisible by K

medium · 49.6% accepted · 683 likes · top 37%

array · hash table · prefix sum

⊣ practice⊣ open on leetcode ↗

Description

You are given an array of integers nums and an integer k.

Return the maximum sum of a subarray of nums, such that the size of the subarray is divisible by k.

Solution