# Category Archives: Matrix

## Number of ways to make exactly C components in a 2*N matrix

Given two positive integers N and C. There is a 2*N matrix where each cell of the matrix can be colored in 0 or 1.… Read More »

## Fast Doubling method to find the Nth Fibonacci number

Given an integer N, the task is to find the N-th Fibonacci numbers. Examples: Input: N = 3 Output: 2 Explanation: F(1) = 1, F(2)… Read More »

## Check if Matrix sum is prime or not

Given a matrix mat[][], the task is to check that the sum of the elements of the matrix is prime or not. Examples: Input: mat[][]… Read More »

## Length of longest connected 1’s in a Binary Grid

Given a grid of size N*M consists of 0 and 1 only, the task is to find the length of longest connected 1s in the… Read More »

## Number of ways to reach (M, N) in a matrix starting from the origin without visiting (X, Y)

Given four positive integers M, N, X, and Y, the task is to count all the possible ways to reach from top left(i.e., (0, 0))… Read More »

## Largest possible square submatrix with maximum AND value

Given an integer matrix mat [ ][ ] dimensions, the task is to find the largest possible square matrix from the given matrix with maximum… Read More »

## Minimize steps required to move all 1’s in a matrix to a given index

Given a binary matrix mat[][] of size NxM and two integers X and Y, the task is to find the minimum number steps required to… Read More »

## Total number of unit cells covered by all given Rectangles

Given a matrix A[][] consisting of coordinates of N rectangles such that {A[i], A[i]} representing bottom left coordinate of rectangle and {A[i], A[i]} representing top… Read More »

## Total number of cells covered in a matrix after D days

Given an N * M matrix and a starting position (X, Y) of a virus, the task is to find out the number of covered… Read More »

## Maximum increase in value of Matrix to keep maximum rows and columns unchanged

Given a matrix mat[][] of dimensionM*N, the task is to find the total maximum possible value must be increased to each cell(say mat[i][j]) such that… Read More »

## Minimum steps to convert all paths in matrix from top left to bottom right as palindromic paths

Given a matrix mat[][] with N rows and M columns. The task is to find the minimum number of changes required in the matrix such… Read More »

## Check if row-major order path of Matrix is palindrome or not

Given a matrix mat[][], the task is to check if the row-major order path of the matrix is a palindrome or not. Examples: Input: mat[][]… Read More »

## Count of ways to traverse a Matrix and return to origin in K steps

Given three integers N, M and K, where N and M are the dimensions of the matrix and K is the maximum possible steps, the… Read More »

## Minimum cost path in a Matrix by moving only on value difference of X

Given a matrix mat[][] and an integer X, the task is to find the minimum number of operations required to reach from . In each… Read More »

## Construct a Matrix of size NxN with values in range [1, N^2] as per given conditions

Content Removed. Please refer Matrix Category for such problems.t My Personal Notes arrow_drop_up Save