Data Structures & AlgorithmsModerateTCS NQT · Infosys

Problem: The array [1, 2, 3, 4, 5, 6, 7, 8, 9] is split into 3 consecutive groups of equal length. What is the sum of the middle group?

  1. A. 6
  2. B. 15
  3. C. 24
  4. D. 45

Correct answer: B. 15

Groups are [1,2,3], [4,5,6], [7,8,9], so the middle sum is 15. The first group sums to 6, the last to 24, and 45 is the whole array.

More Coding Interview Problems questions

Exams that ask this topic