Given a matrix mat[][] of dimensions N*M and an array target[] of M integers, the task is to check whether any row of the matrix… Read More

# Category Archives: Matrix

Given two binary matrices A[] and B[] of dimension N * M and a positive integer K, the task is to find the minimum number… Read More

Given a 2-D array matrix[][] of size M*N and an integer K. For each occurrence of K in the matrix[][], replace K and all the… Read More

Given a N x N chessboard with a Knight initially standing on the Xth row and Yth column, the task is to print all possible… Read More

Given a N x M matrix. Each cell of the matrix has a numerical value pointing to the next cell it leads to. The values… Read More

Given a binary matrix mat[][] of dimensions M*N, the task is to check whether there exist T continuous blocks of 0s or not and at… Read More

Given a matrix mat[][] of dimensions N*M, the task is to check if all the diagonals of the matrix(from top-right to bottom-left) are palindromic or… Read More

Prerequisite: Prefix Sum – 3D Given a 3-Dimensional array of integers arr[L][R][C] (where L, R, and C are dimensions of the array) and 6 integers… Read More

Given a binary matrix mat[][] of dimensions N*M, the task is to find the number of corner rectangles that can be formed. A corner rectangle… Read More

Given a matrix mat[][] of dimensions N*M, the task is to find the size of the largest square submatrix such that the sum of all… Read More

Given two 2D binary arrays, a[][] and b[][] both of size M*N, the task is to pair each row in the array a[][] with any… Read More

Given a matrix mat[][] of dimension N*M which is sorted row-wise and column-wise, the task is to find the sum of the elements of the… Read More

Given a 2D array arr[][] of size M*N containing 1s and 0s where 1 represents that the cell can be visited and 0s represent that… Read More

Given a Matrix grid[][] of size NxM where N is number of rows and M is number of columns. The task is to form a… Read More

Given a boolean 2D array, arr[][] of size N*M where a group of connected 1s forms an island. Two cells are said to be connected… Read More