# Category Archives: Matrix

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

## Minimum cost to sort a matrix of numbers from 0 to n^2 – 1

Given an n x n matrix containing all the numbers in the range 0 to n2-1. The problem is to calculate the total energy required… Read More »

## Counting sets of 1s and 0s in a binary matrixOctober 26, 2017

Given a n × m binary matrix, count the number of sets where a set can be formed one or more same values in a… Read More »

## Mean and Median of a matrixOctober 18, 2017

Given a sorted matrix of size n*n. Calculate the mean and median of the matrix . Examples: Input : 1 2 3 4 5 6… Read More »

## Cholesky Decomposition : Matrix DecompositionOctober 17, 2017

In linear algebra, a matrix decomposition or matrix factorization is a factorization of a matrix into a product of matrices. There are many different matrix… Read More »

## Doolittle Algorithm : LU DecompositionOctober 15, 2017

In numerical analysis and linear algebra, LU decomposition (where ‘LU’ stands for ‘lower upper’, and also called LU factorization) factors a matrix as the product… Read More »

## Shortest distance between two cells in a matrix or gridOctober 13, 2017

Given a matrix of N*M order. Find the shortest distance from a source cell to a destination cell, traversing through limited cells only. Also you… Read More »

## Minimum cost to convert 3 X 3 matrix into magic squareOctober 12, 2017

A Magic Square is a n x n matrix of distinct element from 1 to n2 where the sum of any row, column or diagonal… Read More »

## Unique cells in a binary matrix

Given a matrix of size n x m consisting of 0’s and 1’s.We need to find number of unique cells with value 1 such that… Read More »

## Count entries equal to x in a special matrixOctober 9, 2017

You are given a square matrix (matrix[][]) of order n, where matrix[i][j] = i*j. Find the number of cells which have entry equal to a… Read More »

## Check if a given matrix is sparse or notOctober 8, 2017

A matrix is a two dimensional data objects having m rows and n columns, therefore a total of m*n values. If most of the values… Read More »

## Longest Increasing Path in MatrixOctober 2, 2017

Given a matrix of N rows and M columns. From m[i][j], we can move to m[i+1][j], if m[i+1][j] > m[i][j], or can move to m[i][j+1]… Read More »

## Row-wise common elements in two diagonals of a square matrix

Given a square matrix, find out count of numbers that are same in same row and same in both primary and secondary diagonals. Examples: Input… Read More »

## Minimum cells required to reach destination with jumps equal to cell valuesOctober 1, 2017

Given a m x n matrix mat[][] containing positive integers. The problem is to reach to the cell (m-1, n-1) from the cell (0, 0)… Read More »