← 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

Hiring now

Agoda has 245 open roles right now

landed applies to roles like these for you, on each company’s own site, with answers written for the role.

Get 5x interviews10 free auto-applies. No card.
  • Customer Experience Specialist - Graveyard Shift (Kuala Lumpur)

    Kuala Lumpur, Malaysia

  • Payment disputes coordinator (10-month contract) (Bangkok-Based, No Visa Provided)

    Bangkok, Thailand

  • Payment Operations Coordinator (10-month contract) (Bangkok-Based, No Visa Provided)

    Bangkok, Thailand

Or practice this question first

Next question