DriveReady

P03 — Accumulation — every solution explained

This lesson is part of full access

One payment of ₹250 opens every lesson, practice set and mock for all five companies. No subscription, no expiry.

What is inside

  • 1. Sum of elements at even indices
  • 2. Sum of even-VALUED elements. (Not the same as 1 -- read carefully.)
  • 3. Running maximum after each step
  • 4. Count elements strictly greater than the running average so far
  • 5. Longest run of equal consecutive values
  • 6. Alternating sum: a0 - a1 + a2 -
  • 7. Count how many prefix sums are divisible by k
  • 8. Index of the first element greater than a threshold, else -1
  • 9. Sum, applying +10% to every third element (index 2, 5, 8...). Integer arithmetic, truncating -- states the rounding rule explicitly
  • 10. Count sign changes between consecutive elements (zeros are skipped)
  • 11. Maximum sum of any contiguous subarray (Kadane). Allows all-negative
  • 12. Total of values that are divisible by d, minus (index % m)