Leaderboard
Showing:
Multiply 2 matrices
Basic Accuracy: 50.0% Submissions: 2 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}}

 

Your Task:
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

to report an issue on this page.

Editorial

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

Yes

All Submissions

My Submissions:

Login to access your submissions.

Multiply 2 matrices

Output Window