# Category Archives: Matrix

## Mirror of matrix across diagonalNovember 19, 2017

Given a 2-D array of order N x N, print a matrix which is mirror of given tree across diagonal. We need to print the… Read More »

## Python program to multiply two matrices

Given two matrix the task is that we will have to create a program to multiply two matrices in paython. Examples: Input : X =… Read More »

## Printing string in plus ‘+’ pattern in the matrixNovember 17, 2017

Given a string, print it inside a matrix in such a way that a ‘plus’ is formed. Examples: Input: TOP Output: X T X T… Read More »

## Number of days until all chocolates become unhealthyNovember 16, 2017

Pablo has square chocolate Box of size n x n in which a variety of healthy chocolates are present denoted by ‘H’ initially but he… Read More »

## Find if there is a rectangle in binary matrix with corners as 1November 15, 2017

There is a given binary matrix, we need to find if there exists any rectangle or square in the given matrix whose all four corners… Read More »

## Print all n digit patterns formed by mobile KeypadNovember 12, 2017

Given a number n. we need to print all N digit pattern formed by mobile Keypad. Note: we can move up, down, left, right from… Read More »

## Rotate a Matrix by 180 degree

Given a square matrix the task is that we turn it by 180 degrees in anti-clockwise direction without using any extra space. Examples: Input :… Read More »

## Find all rectangles filled with 0November 10, 2017

We have one 2D array, filled with zeros and ones. We have to find the starting point and ending point of all rectangles filled with… Read More »

## heapq in Python to print all elements in sorted order from row and column wise sorted matrixNovember 7, 2017

Given an n x n matrix, where every row and column is sorted in non-decreasing order. Print all elements of matrix in sorted order. Examples:… Read More »

## Count all 0s which are blocked by 1s in binary matrixNovember 6, 2017

Given Binary matrix. Task is count all zeros which are surrounded by one (may not be immediate neighbor). Note: here we are only taking four… Read More »

## Minimum sum submatrix in a given 2D arrayNovember 1, 2017

Given a 2D array, find the minimum sum submatrix in it. Examples: Input : M[][] = {{1, 2, -1, -4, -20}, {-8, -3, 4, 2,… Read More »

## Python program to add two MatricesOctober 31, 2017

Aim : Program to compute the sum of two matrices and then print it in Python. Examples: Input : X= [[1,2,3], [4 ,5,6], [7 ,8,9]]… Read More »

## Multiplication of two Matrices in Single line using Numpy in PythonOctober 30, 2017

Matrix multiplication is an operation that takes two matrices as input and produces single matrix by multiplying rows of the first matrix to the column… Read More »

## Sum 2D array in Python using map() functionOctober 28, 2017

Given a 2-D matrix, we need to find sum of all elements present in matrix ? Examples: Input : arr = [[1, 2, 3], [4,… Read More »

## Conway’s Game Of Life (Python Implementation)October 27, 2017

Conways’s Game Of Life is a Cellular Automation Method created by John Conway. This game was created with Biology in mind but has been applied… Read More »