Tap here to switch tabs
Problem
Submissions

Problem: K-Concatenation Maximum Sum

med
30 min
Try to solve the K-Concatenation Maximum Sum problem.

Statement

Given an integer array arr and an integer k, find the maximum subarray sum in the array obtained by concatenating arr k times.

The subarray can be empty, which corresponds to a sum of 00.

Since the answer may be very large, return the result modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq arr.length ≤105\leq 10^5

  • 1≤1 \leq k ≤105\leq 10^5

  • −104≤-10^4 \leq arr[i] ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: K-Concatenation Maximum Sum

med
30 min
Try to solve the K-Concatenation Maximum Sum problem.

Statement

Given an integer array arr and an integer k, find the maximum subarray sum in the array obtained by concatenating arr k times.

The subarray can be empty, which corresponds to a sum of 00.

Since the answer may be very large, return the result modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq arr.length ≤105\leq 10^5

  • 1≤1 \leq k ≤105\leq 10^5

  • −104≤-10^4 \leq arr[i] ≤104\leq 10^4