# Category Archives: Matrix

Given a binary matrix grid[][] of size M*N where ‘0‘ represents a blocked cell and ‘1’ represents a normal cell and a source (sx, sy)… Read More
Given a matrix mat[][] of size N * N, where mat[i][j] represents the time taken to reach from ith city to jth city. Also, given… Read More
Given a matrix A[][] of size N * N, where each matrix element is either -1 or 1. One can move from (X, Y) to… Read More
What is the Determinant of a Matrix? The determinant of a Matrix is a special number that is defined only for square matrices (matrices that have… Read More
Given two N x M matrices. Find a N x M matrix as the sum of given matrices each value at the sum of values of… Read More
Given a 2D matrix, the task is to find Trace and Normal of matrix.Normal of a matrix is defined as square root of sum of… Read More
The below program checks if two square matrices of size 4*4 are identical or not. For any two matrices to be equal, the number of… Read More
Given two matrices, the task to multiply them. Matrices can either be square or rectangular. Examples:  Input : mat1[][] = {{1, 2}, {3, 4}} mat2[][]… Read More
Given a 2D square matrix, find the sum of elements in Principal and Secondary diagonals. For example, consider the following 4 X 4 input matrix. … Read More
Given a 2D array, sort each row of this array and print the result.Examples:  Input: 77 11 22 3 11 89 1 12 32 11… Read More
Given a matrix, clockwise rotate elements in it. Examples: Input: 1 2 3 4 5 6 7 8 9 Output: 4 1 2 7 5… Read More
Transpose of a matrix is obtained by changing rows to columns and columns to rows. In other words, transpose of A[][] is obtained by changing… Read More
Given a 4 x 4 matrix, the task is to interchange the elements of first and last columns and show the resulting matrix.Examples:   Input: 8… Read More
Given a grid of dimension M * N where each cell varies from 1 to 6 and each of the values present in the cell… Read More
Construct a matrix whose each row contains N 1’s and each column contains M 1’s. Examples: Input: N = 3, M = 4Output:1 1 11… Read More