# Category Archives: Matrix

## Construct Linked List from 3D Matrix

Given a 3D matrix mat[ ][ ][ ] of size X * Y * Z. The task is to convert this matrix into a fully… Read More »

## Minimum steps to convert all top left to bottom right paths in Matrix as palindrome | Set 2

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 »

## Create matrix whose sum of diagonals in each sub matrix is even

Given a number N, the task is to create a square matrix of size N*N with values in range [1, N*N], such that the sum… Read More »

## Kth diagonal from the top left of a given matrix

Given a squared matrix M[ ][ ] of N * N dimensions, the task is to find the Kth diagonal of the matrix, starting from… Read More »

## Generalized Fibonacci Numbers

We all know that Fibonacci numbers (Fn) is defined by the recurrence relation   Fibonacci Numbers (Fn) = F(n-1) + F(n-2) with seed values F0 = 0 and… Read More »

## Count of all subsequences having adjacent elements with different parity

Given an array arr[] of size N, the task is to find the number of non-empty subsequences from the given array such that no two… Read More »

## Count of submatrix with sum X in a given Matrix

Given a matrix of size N x M and an integer X, the task is to find the number of sub-squares in the matrix with… Read More »

## Count of ways to generate a Matrix with product of each row and column as 1 or -1

Given two integers N and M, the task is to find the numbers of ways to form a matrix of size N * M consisting… Read More »

## Sorting boundary elements of a matrix

Given a matrix mat[][] of size M*N, the task is to sort only the border elements of the matrix in the clockwise direction and print… Read More »

## Color a grid such that all same color cells are connected either horizontally or vertically

Given three integers R, C, N, and an array arr[] of size N. The task is to color all cells of a grid of R… Read More »

## Find if there is a path between two vertices in a directed graph | Set 2

Given a Directed Graph and two vertices in it, check whether there is a path from the first given vertex to second. Example: Consider the… Read More »

## Count of ways to select K consecutive empty cells from a given Matrix

Given a binary matrix V[][] of dimensions N * M, wherein each cell is either empty or blocked marked by a 0 and 1 respectively,… Read More »

## Check if a graph is Strongly, Unilaterally or Weakly connected

Given an unweighted directed graph G as a path matrix, the task is to find out if the graph is Strongly Connected or Unilaterally Connected… Read More »

## Minimum number of points required to cover all blocks of a 2-D grid

Given two integers N and M. The task is to find the minimum number of points required to cover an N * M grid.   A… Read More »

## Final direction after visiting every cell of Matrix starting from (0, 0)

Given a 2D grid of size N x M. The task is to find the final direction after visiting every cell under given conditions. You… Read More »