Data Structures & AlgorithmsModerateTCS NQT · matrix basics

Problem: How many scalar multiplications does the naive product of a 3 x 4 matrix and a 4 x 2 matrix need?

  1. A. 18
  2. B. 12
  3. C. 6
  4. D. 24

Correct answer: D. 24

Each of the 3 * 2 = 6 output entries needs 4 multiplications, giving 24. The trap 12 comes from counting only one dimension.

More Coding Interview Problems questions

Exams that ask this topic