Pergunta de entrevista da empresa Citadel

Write code to multiply two matrices.

Respostas da entrevista

Sigiloso

8 de out. de 2013

int main() { const int N = SOME_NUMBER int a[n][n], int b[n][n], int c[n][n]; int sum = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { sum = 0; for (int k = 0; k < N; k++) { sum += A[i][k] * B[k][j]; } C[i][j] = sum; } } }

1

Sigiloso

12 de fev. de 2016

This question gives a lot of opportunity for candidate. You could ask interviewer if he expects simple (math) implementation and gave above one. He would like to see fast implementation with processor cache in mind, and go from here with a lot of discussions and optimizations.