# Category Archives: Matrix

Write a code which inputs two numbers m and n and creates a matrix of size m x n (m rows and n columns) inâ€¦ Read More
Given an n x n matrix, where every row and column is sorted in non-decreasing order. Find the kth smallest element in the given 2Dâ€¦ Read More
Given two square matrices A and B of size n x n each, find their multiplication matrix.  Naive Method: Following is a simple way toâ€¦ Read More
The problem is to count all the possible paths from the top left to the bottom right of a M X N matrix with theâ€¦ Read More
The problem is to print all the possible paths from top left to bottom right of a mXn matrix with the constraints that from eachâ€¦ Read More
Given a 2D matrix, print all elements of the given matrix in diagonal order. For example, consider the following 5 X 4 input matrix.   Example:â€¦ Read More
Given a 2D array, find the maximum sum submatrix in it. For example, in the following 2D array, the maximum sum submatrix is highlighted withâ€¦ Read More
Given a binary 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5â€¦ Read More
Given an M x N matrix, transpose the matrix without auxiliary memory.It is easy to transpose matrix using an auxiliary array. If the matrix isâ€¦ Read More
Given a binary matrix, print all unique rows of the given matrix.  Example:  Input: {0, 1, 0, 0, 1} {1, 0, 1, 1, 0} {0,â€¦ Read More
Given a boolean 2D array, where each row is sorted. Find the row with the maximum number of 1s.  Example:   Input matrix : 0 1â€¦ Read More
A magic square of order n is an arrangement of n2 numbers, usually distinct integers, in a square, such that the n numbers in allâ€¦ Read More
Given a partially filled 9×9 2D array ‘grid[9][9]’, the goal is to assign digits (from 1 to 9) to the empty cells so that everyâ€¦ Read More
In a party of N people, only one person is known to everyone. Such a person may be present at the party, if yes, (s)heâ€¦ Read More
Given the dimension of a sequence of matrices in an array arr[], where the dimension of the ith matrix is (arr[i-1] * arr[i]), the taskâ€¦ Read More