Given two integers N and M, the task is to generate any N * M sized maze containing only 0 (representing a wall) and 1… Read More
Category Archives: Matrix
For a given matrix before[][], the corresponding cell (x, y) of the after[][] matrix is calculated as follows: res = 0;for(i = 0; i <=… Read More
Given a grid on the XY plane with dimensions r x c (where r denotes maximum cells along the X axis and c denotes maximum… Read More
Given a binary matrix arr[][] of N rows and M columns. The task is to find the number of cells in the matrix, where Bitwise… Read More
Given a 3D array of size N*M*P consisting only of English alphabet characters, the task is to print the frequency of all the elements in… Read More
Geek is in a maze of size N * M. Each cell in the maze is made of either ‘.’ or ‘#’. An empty cell… Read More
Given a matrix arr[] of size N*N containing English alphabets characters, the task is to find the frequency of all the matrix elements. Note: Print… Read More
Given a 2D array arr[] having N rows of variable size, the task is to sort the array in lexicographical order i.e., sort each row… Read More
Given a binary matrix mat[][] of size N*M, find the maximum size rectangle binary-sub-matrix with all 1’s. Examples: Input: mat[][] = { {0, 1, 1,… Read More
Given a matrix mat[][] of size N * M and an integer K, the task is to find a path from the top-left cell (0,… Read More
Given a matrix of size N * M and Q queries, the task is to find how many different regions will be there, after performing… Read More
Given an odd positive integer N, which denotes the size of an N*N square matrix filled with 1s, the task is to find the minimum… Read More
Given a matrix of size N x M initially filled with 1, the task is to find the number of ways to make the sum… Read More
Given integer N denoting the size of a square matrix whose each element is the sum of its row and column i.e., mat[i][j] = i… Read More
Given two values M and N, fill a matrix of size ‘M*N’ in a spiral (or circular) fashion (clockwise) with given array elements. Examples: … Read More