Domanda di colloquio di Citadel

Write code to multiply two matrices.

Risposte di colloquio

Anonimo

8 ott 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

Anonimo

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.