← All questions
MediumCoding
Maximum Sum Circular Subarray
Asked at
Agoda
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Compute ordinary maximum subarray
- 02Compute ordinary minimum subarray
- 03Use total minus minimum for wrapped candidate
- 04Reject the all-negative wrapped case
- 05Return the better valid candidate
Reference answer
Then expect these follow-ups
Why is the excluded part contiguous?
Tests: correctness reasoning
How would indices be reconstructed for the wrapped case?
Tests: implementation extension
Free to read · better with Enzo
Practice this out loud with Enzo
Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.
Next question