← All problemsSign in

Maximum Subarray

CodeChefRating 1613Open on judge ↗

Given two arrays $A$ and $B$ of sizes $N$ and $M$ respectively. You can apply the following operation until the array $B$ is non-empty: - Choose either the **first** or the **last** element of array $B$. - Insert the chosen element to either the **front** or the **back** of array $A$. - Delete the chosen element from array $B$. For example, let $A = [9, 7]$ and $B = [1, 3, 2]$. In one operation,

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start