
Problem
Solution
Submissions
Perform Matrix Multiplication.
Certification: Advanced Level
Accuracy: 100%
Submissions: 2
Points: 15
Write a Python program that performs matrix multiplication on two given matrices.
Example 1
- Input 1: [[1, 2], [3, 4]]
- Input 2: [[5, 6], [7, 8]]
- Output: [[19, 22], [43, 50]]
- Explanation:
- Step 1: Take the input matrices.
- Step 2: Perform matrix multiplication.
- Step 3: Return the resulting matrix.
Example 2
- Input 1: [[1, 2, 3], [4, 5, 6]]
- Input 2: [[7, 8], [9, 10], [11, 12]]
- Output: [[58, 64], [139, 154]]
- Explanation:
- Step 1: Take the input matrices.
- Step 2: Perform matrix multiplication.
- Step 3: Return the resulting matrix.
Constraints
- The number of columns in matrix1 must equal the number of rows in matrix2.
- 1 ≤ rows, columns ≤ 100
- Matrix elements are integers.
- Time Complexity: O(n^3), where n is the size of the matrices.
- Space Complexity: O(n^2)
Editorial
My Submissions
All Solutions
Lang | Status | Date | Code |
---|---|---|---|
You do not have any submissions for this problem. |
User | Lang | Status | Date | Code |
---|---|---|---|---|
No submissions found. |
Solution Hints
- Use nested loops to iterate through rows of the first matrix and columns of the second matrix.
- Multiply corresponding elements and sum them up to get the result matrix.
- Ensure the dimensions of the matrices are compatible for multiplication.