Question d’entretien chez Citadel

Write code to multiply two matrices.

Réponses aux questions d'entretien

Utilisateur anonyme

8 oct. 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

Utilisateur anonyme

12 févr. 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.