Search
⌘K

Leetcode 1191. K-Concatenation Maximum Sum

Find the maximum subarray sum in the array obtained by repeating arr k times (empty subarray allowed, return 0) and output the result modulo 1e9+7. Key challenge: handle large k efficiently by combining Kadane on up to two concatenated copies with prefix/suffix and total-sum reasoning (total sum positive vs nonpositive).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.