Category Archives: Matrix

Program to check if matrix is lower triangular

Given a square matrix and the task is to check the matrix is in lower triangular form or not. A square matrix is called lower… Read More »

Count of possible hexagonal walks

We are given an infinite two dimensional plane made of hexagons connected together. We can visualize this plane as a honeycomb. Element X is present… Read More »

Program to check if matrix is upper triangular

Given a square matrix and the task is to check the matrix is in upper triangular form or not. A square matrix is called upper… Read More »

Check if possible to cross the matrix with given power

Given a matrix of N X M, each cell consist of an integer. We have initial power of K and we are allowed to move… Read More »

Find trace of matrix formed by adding Row-major and Column-major order of same matrix

Given two integers N and M. Consider two matrix ANXM, BNXM. Both matrix A and matrix B contains elements from 1 to N*M. Matrix A… Read More »

Maximum sum path in a matrix from top to bottom

Consider a n*n matrix. Suppose each cell in the matrix has a value assigned. We can go from each cell in row i to a… Read More »

Program for Identity Matrix

Introduction to Identity Matrix : The dictionary definition of an Identity Matrix is a square matrix in which all the elements of the principal or… Read More »

Number of elements greater than modified mean in matrix

Normally mean of matrix is the average of all elements present in matrix. Consider a modified mean as floor of mean of row-wise minimum and… Read More »

Minimum jumps to reach last building in a matrix

Given a matrix containing an integer value, In which each cell of the matrix represents height of building. Find minimum jumps needed reach from First… Read More »

Program to swap upper diagonal elements with lower diagonal elements of matrix.

Given a square matrix, swap upper diagonal elements of matrix with lower diagonal elements of matrix. Examples: Input: 2 3 5 6 4 5 7… Read More »

Ways of filling matrix such that product of all rows and all columns are equal to unity

We are given three values , and where is number of rows in matrix, is number of columns in the matrix and is the number… Read More »

Mirror of matrix across diagonal

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 matrix

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 unhealthy

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 »