X DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Multiply 2 matrices
Basic Accuracy: 70.8% Submissions: 1266 Points: 1

For 2 given matrices of size n x n. Your task is to multiply them.

Example 1:â€‹

â€‹Input:
matrixA = {{1, 1, 1}, {1, 1, 1},
{1, 1, 1}}
matrixB = {{1, 1, 1}, {1, 1, 1},
{1, 1, 1}}
Output: {{3, 3, 3}, {3, 3, 3}, {3, 3, 3}}

Example 2:

Input:
matrixA = {{1, 2}, {3, 4}},
matrixB = {{4, 3}, {2, 1}}
Output: {{8, 5}, {20, 13}}


You don't need to read or print anything. Your task is to complete the function Multiply() which takes two matrices matrixA amd matrixB as input parameter and multiply the two matrices. You don't have to return anything. Copy the values of output matrix into matrixA.

Expected Time Compelxity: O(n3)
Expected Space Complexity: O(n2)

Constraints:
1 <= n <= 100
1 <= elements of matrices <= 100

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

#### My Submissions:  