# Category Archives: Matrix

## Find the element at the specified index of a Spirally Filled Matrix

Given two integers x and y representing the row and column number in a matrix respectively, the task is to find the integer at the… Read More »

## Add and Remove Edge in Adjacency Matrix representation of a Graph

Prerequisites: Graph and its representations Given an adjacency matrix g[][] of a graph consisting of N vertices, the task is to modify the matrix after… Read More »

## Flood Fill Algorithm

Given a 2D screen arr[][] where each arr[i][j] is an integer representing the colour of that pixel, also given the location of a pixel (X,… Read More »

## Find position of non-attacking Rooks in lexicographic order that can be placed on N*N chessboard

Given an integer N and an array arr[] of positions which denotes the positions of already placed non-attacking rooks, the task is to find the… Read More »

## Check if a Matrix is Bitonic or not

Given a matrix m[][], the task is to check if the given matrix is Bitonic or not. If the given matrix is Bitonic, then print… Read More »

## Construct a matrix with sum equal to the sum of diagonal elements

Given an integer N, the task is to construct a matrix of size N2 using positive and negative integers and excluding 0, such that the… Read More »

## Minimize count of divisions by D to obtain at least K equal array elements

Given an array A[ ] of size N and two integers K and D, the task is to calculate the minimum possible number of operations… Read More »

## Find cells in Matrix that are not visited by Robot for given movements

Given an integer N, which denotes the size of the matrix that is N*N. There is a robot placed over the top-left corner of the… Read More »

## Puzzle | Connect 9 circles each arranged at center of a Matrix using 3 straight lines

Consider 9 circles each arranged at the center of cells of a 2-D matrix of shape 3*3. Draw 3 straight lines without removing pen from… Read More »

## Minimum changes required to make each path in a matrix palindrome

Given a matrix with N rows and M columns, the task is make all possible paths from the cell (N, M) to (1, 1) palindrome… Read More »

## 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 »