🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Kadane's Algorithm: all 13 questions

Quiz: Kadane's Algorithm · Question 3 of 13

What is the maximum subarray sum of [-5, -2, -7] (subarrays must be non-empty)?

What is the maximum subarray sum of [-5, -2, -7] (subarrays must be non-empty)?

  1. A.0
  2. B.-2
  3. C.-14
  4. D.-5
Answer & explanation

Correct answer: -2

With every number negative, the best non-empty subarray is the single largest element.

Can you get the rest right without peeking?

Take the timed Quiz: Kadane's Algorithm quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →