Data Structures & AlgorithmsHardProduct placement · Amazon/Microsoft

Only the lower triangle (including the diagonal) of a 12 × 12 matrix is stored row by row in a 1-D array B starting at B[0] (indices 0-based). At which index of B is element (4, 3) stored?

  1. A. 13
  2. B. 34
  3. C. 14
  4. D. 9

Correct answer: A. 13

Rows 0..3 before row 4 hold 1 + 2 + … + 4 = 10 elements, then 3 more in row 4: index 13.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic