Frage im Vorstellungsgespräch bei Citadel

Write code to multiply two matrices.

Antworten zu Vorstellungsgespräch

Anonym

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

Anonym

12. Feb. 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.