##
Find a peak element in a 2D array
May 14, 2017

An element is a peak element if it is greater than or equal to its four neighbors, left, right, top and bottom. For example neighbors… Read More »

May 14, 2017

An element is a peak element if it is greater than or equal to its four neighbors, left, right, top and bottom. For example neighbors… Read More »

Given a sorted matrix mat[n][m] and an element ‘x’. Find position of x in the matrix if it is present, else print -1. Matrix is… Read More »

April 16, 2017

Given a matrix of n X n. The task is to calculate the absolute difference between the sums of its diagonal. Examples: Input : mat[][]… Read More »

Given a matrix of size n x n, find sum of the Zigzag sequence with the largest sum. A zigzag sequence starts from the top… Read More »

April 15, 2017

Given two values m and n, fill a matrix of size ‘m*n’ in spiral (or circular) fashion (clockwise) with natural numbers from 1 to m*n.… Read More »

April 11, 2017

Given a binary N x N matrix, we need to find the total number of matrix positions from which there is an endless path. Any… Read More »

April 10, 2017

Background: Following are the rules of Suduku for a player. In all 9 sub matrices 3×3 the elements should be 1-9, without repetition. In all… Read More »

April 3, 2017

Initially, there is a grid with some cells which may be alive or dead. Our task to generate the next generation of cells based on… Read More »

March 31, 2017

Given a positive integer N. Consider a matrix of N X N. No cell can be accessible from any other cell, except the given pair… Read More »

March 20, 2017

Given a 2D matrix, the task is that we find maximum sum of a hour glass. An hour glass is made of 7 cells in… Read More »

March 19, 2017

Given a grid which consists of 4 types of characters : ‘B’ ‘.’ ‘S’ and ‘D’. We need to reach D starting from S, at… Read More »

March 12, 2017

Given a square matrix, turn it by 90 degrees in anti-clockwise direction without using any extra space. Examples: Input 1 2 3 4 5 6… Read More »

March 11, 2017

Given a square matrix of order n*n, find the maximum and minimum from the matrix given. Examples: Input : arr[][] = {5, 4, 9, 2,… Read More »

March 7, 2017

Given a 2D array, the task is to print matrix in anti spiral form: Examples: Output: 16 15 14 13 12 11 10 9 8… Read More »

March 6, 2017

A Skew Symmetric Matrix or Anti-Symmetric Matrix is a square matrix whose transpose is negative to that of the original matrix. If the entry in… Read More »