🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Kadane's Algorithm: questions with answers

13 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. In Kadane's algorithm, when does the current subarray "restart" at x?
  3. Q3. What is the maximum subarray sum of [-5, -2, -7] (subarrays must be non-empty)?
  4. Q4. What are the time and extra space of Kadane's algorithm?
  5. Q5. For the maximum CIRCULAR subarray, a wrapping subarray's best sum equals:
  6. Q6. Why does the maximum PRODUCT subarray track the smallest product as well?
  7. Q7. What does this print? (code)
  8. Q8. Kadane's algorithm is an example of which technique?
  9. Q9. What does this print? (code)
  10. Q10. Why does Kadane start with best = a[0] instead of best = 0?
  11. Q11. What does this print? (code)
  12. Q12. In the maximum circular subarray code, why return bestmax when it is negative?
  13. Q13. In the maximum product subarray, why swap hi and lo when x is negative?