# Category Archives: Matrix

## Largest area rectangular sub-matrix with equal number of 1’s and 0’sSeptember 26, 2017

Given a binary matrix. The problem is to find the largest area rectangular sub-matrix with equal number of 1’s and 0’s. Examples: Input : mat[][]… Read More »

## Maximize the binary matrix by filpping submatrix onceSeptember 24, 2017

Given a binary matrix of R rows and C columns. We are allowed flip to any size of sub matrix. Flipping means changing 1 to… Read More »

## Print all palindromic paths from top left to bottom right in a matrixSeptember 20, 2017

Given a matrix containing lower alphabetical characters only, we need to print all palindromic paths in given matrix. A path is defined as a sequence… Read More »

## Possible moves of knightSeptember 17, 2017

Given a chess board of dimension m * n. Find number of possible moves where knight can be moved on a chessboard from given position.… Read More »

## Check if sums of i-th row and i-th column are same in matrixSeptember 10, 2017

Given a matrix mat[][], we have to check if the sum of i-th row is equal to the sum of i-th column or not. Examples:… Read More »

## Find row number of a binary matrix having maximum number of 1sSeptember 9, 2017

Given a binary matrix (containing only 0 and 1) of order n*n. All rows are sorted already, We need to find the row number with… Read More »

## Best meeting point in 2D binary arraySeptember 6, 2017

You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in a group. And the group… Read More »

## Check if a grid can become row-wise and column-wise sorted after adjacent swaps

Given a grid of size n x len filled with lowercase characters. We can swap two adjacent characters in the same row and column. Now… Read More »

## Program to check if a matrix is symmetricSeptember 5, 2017

A square matrix is said to be symmetric matrix if the transpose of the matrix is same as the given matrix. Symmetric matrix can be… Read More »

## Find duplicate rows in a binary matrix

Given a binary matrix whose elements are only 0 and 1, we need to print the rows which are duplicate of rows which are already… Read More »

## Find if a 2-D array is completely traversed or not by following the cell valuesSeptember 2, 2017

You are given a 2-D array. We have to traverse each and every cell of given array by following the cell locations then return true… Read More »

## Minimum cells traversed to reach corner where every cell represents jumpsSeptember 1, 2017

Suppose A is at position (0, 0) of a 2-D grid containing ‘m’ rows and ‘n’ columns. His aim is to reach the bottom right… Read More »

## Unique paths in a Grid with ObstaclesAugust 28, 2017

Given a grid of size m * n, let us assume you are starting at (1, 1) and your goal is to reach (m, n).… Read More »

## Largest rectangular sub-matrix whose sum is 0August 27, 2017

Given a 2D matrix, find the largest rectangular sub-matrix whose sum is 0. for example consider the following N x M input matrix Examples: Input… Read More »

## Efficiently compute sums of diagonals of a matrixAugust 26, 2017

Given a 2D square matrix, find sum of elements in Principal and Secondary diagonals. For example, consider the following 4 X 4 input matrix. A00… Read More »