# Category Archives: Matrix

## Find Maximum Length Of A Square Submatrix Having Sum Of Elements At-Most K

Given a N x M matrix where N is the number of rows and M is the number of columns in the given matrix and… Read More »

## Find Number of Even cells in a Zero Matrix after Q queries

Given a Zero matrix of N x N size, the task is to find the numbers of cells containing even numbers after performing Q queries.… Read More »

## Largest row-wise and column-wise sorted sub-matrix

Given an N * M matrix mat[][], the task is to find the area-wise largest rectangular sub-matrix such that each column and each row of… Read More »

## Number of cells in matrix which are equidistant from given two points

Given a matrix of N rows and M columns, given two points on the matrix; the task is to count the number of cells that… Read More »

## Check if all the elements can be made of same parity by inverting adjacent elements

Given a binary matrix. In a single operation, you are allowed to choose two adjacent elements and invert their parity. The operation can be performed… Read More »

## Minimum cost to reach from the top-left to the bottom-right corner of a matrix

Given an N * M matrix mat[][] consisting of lower case characters, the task is to find the minimum cost to reach from the cell… Read More »

## Print all possible paths from the first row to the last row in a 2D array

Given a 2D array of characters with M rows and N columns. The task is to print all the possible paths from top (first row)… Read More »

A graph is a presentation of a set of entities where some pairs of entities are linked by a connection. Interconnected entities are represented by… Read More »

## Expected number of moves to reach the end of a board | Matrix Exponentiation

Given a linear board of length N numbered from 1 to N, the task is to find the expected number of moves required to reach… Read More »

## Expected number of moves to reach the end of a board | Dynamic programming

Given a linear board of length N numbered from 1 to N, the task is to find the expected number of moves required to reach… Read More »

## Find the minimum difference path from (0, 0) to (N-1, M-1)

Given two 2D arrays b[][] and c[][] of N rows and M columns. The task is to minimise the absolute difference of the sum of… Read More »

## Number of cells in a matrix that satisfy the given condition

Given an N * N grid consisting of empty cells (denoted by ‘1’) and obstacles (denoted by ‘0’), the task is to find the number… Read More »

## Minimum steps to get 1 at the center of a binary matrix

Given an N * N matrix where N is odd with all 0 values except for a single cell which has the value 1. The… Read More »

## Find N in the given matrix that follows a pattern

Given an infinite matrix filled with the natural numbers as shown below: 1 2 4 7 . . . 3 5 8 . . .… Read More »

## Minimum cells to be flipped to get a 2*2 submatrix with equal elements

Given a matrix of size M * N, the task is to find the count of the minimum number of cells that must be flipped… Read More »