def matrix_multiply_sequential(A, B): n = len(A) result = [[0] * n for _ in range(n)] for i in range(n): for j in range(n): result[i][j] = sum(A[i][k] * B[k][j] for k in range(n)) return result