Category Archives: Matrix

Given an NxN square matrix M[][]. The task is to check whether the matrix M is a zero division matrix or not. A matrix is… Read More
Given a matrix arr[][] of size M*N containing only positive integers, the task is to check if every row contains all the integers from 1… Read More
Given a binary matrix of size M*N containing only 0 and 1. The task is to count the number of mappings in the matrix. There… Read More
The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in… Read More
Given three integers M, N and K, the task is to count all the possible paths from the cell (0, 0, 0) to cell (M-1,… Read More
Given a 2D matrix arr[] of size N*M, the task is to find the number of rows and columns having all primes. Examples: Input: arr[]=… Read More
Given an encoded (or encrypted) string S of length N, an integer M. The task is to decrypt the ecrypted string and print it. The… Read More
Given an integer N and three N x N matrices X[][], Y[][], and Z[][], the task is to calculate the minimum cost required to reach… Read More
Given two points P1(x1, y1) and P2(x2, y2) of a matrix, the task is to find the minimum cost to reach P2 from P1 when:… Read More
Given a matrix of dimension N*M, the task is to maximize the total number of occupied cells in the given matrix such that they follow… Read More
Given a 2D-array mat[][] of order M*N. The task is to replace every element of each row with the product of other elements of the… Read More
Given a matrix mat[ ][ ] of size N*N and an integer K, containing integer values, the task is to replace diagonal elements by the… Read More
Given a square matrix mat[][] of order N containing integers in range [0, N), the task is to rearrange the matrix elements in the given… Read More
Given two 2D arrays arr[][] and brr[][] of equal size. The task is to find the minimum number of rotations required either clockwise or anticlockwise… Read More
Given a N x N matrix, such that the element at the index [N/2, N/2] is missing, the task is to find the maximum integer… Read More