Reshaping the matrix

Given a matrix of dimensions m x n, reshape it to the provided dimensions p x q given that m x n = p x q. Otherwise, display an error.

Example

Get hands-on with 1200+ tech skills courses.