← All questions
MediumCoding

Maximum Sum Circular Subarray

Asked atAgoda
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+
  1. 01Compute ordinary maximum subarray
  2. 02Compute ordinary minimum subarray
  3. 03Use total minus minimum for wrapped candidate
  4. 04Reject the all-negative wrapped case
  5. 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