# Category Archives: Matrix

## Sort Matrix in alternating ascending and descending order rowwise

Given an N x N matrix, our task is to print the row of the matrix in ascending and descending order alternatively. Examples: Input: 5… Read More »

## Real-time application of Data Structures

A data structure is a particular way of organizing data in a computer so that it can be used effectively. In this article, the real-time… Read More »

## Count of palindromic plus paths in a given Matrix

Given an N x M matrix of integers, the task is to count the number of palindromic pluses in the array. Palindromic plus is formed… Read More »

## Minimum sprinklers required to water a rectangular park

Given N * M rectangular park having N rows and M columns, each cell of the park is a square of unit area and boundaries… Read More »

## Check if a matrix contains a square submatrix with 0 as boundary element

Given an N*N binary matrix arr[][], the task is to check if the matrix contains a square of at least size 2 x 2 whose… Read More »

## Check if a given string can be formed using characters of adjacent cells of a Matrix

Given a matrix board of characters and a string Word, the task is to check if Word exists on the board constructed from a sequence… Read More »

## Find dependencies of each Vertex in a Directed Graph

Given a directed graph containing N vertices and M edges, the task is to find all the dependencies of each vertex in the graph and… Read More »

## Number of ways of cutting a Matrix such that atleast one cell is filled in each part

Given an integer K and a matrix mat[][] containing 1 and 0, where 1 denotes the cell is filled and 0 denotes an empty cell.… Read More »

## Minimum number of operations required to set all elements of a binary matrix

Given a binary matrix mat[][] consisting of 1s and 0s of dimension M * N, the task is to find the number of operations to… Read More »

## Sum of cost of all paths to reach a given cell in a Matrix

Given a matrix grid[][] and two integers M and N, the task is to find the sum of cost of all possible paths from the… Read More »

## Number of ways to paint K cells in 3 x N grid such that no P continuous columns are left unpainted

Given three integers N, P and K, the task is to find the number of ways of painting K cells of 3 x N grid… Read More »

## Count of numbers in given range L to R which are present in a Matrix

Given a matrix(mat[][]), which is sorted row and column-wise in increasing order. Two integers are given, L and R, our task is to count number… Read More »

## C program to implement Adjacency Matrix of a given Graph

Given a undirected Graph of N vertices 1 to N and M edges in form of 2D array arr[][] whose every row consists of two… Read More »

## Minimum moves taken to move coin of each cell to any one cell of Matrix

Given an odd number N which represents a grid of size N x N which is initially filled by coins, the task is to find… Read More »

## Check if it is possible to get given sum by taking one element from each row

Given a 2-D array of N rows and M columns and an integer K. The task is to find whether is it possible to take… Read More »