# Category Archives: Matrix

## Encryption and Decryption of String according to given technique

Given a string S, the task is to encrypt the string and decrypt the string again to the original form. Encryption Technique: If L is… Read More »

## Path with maximum product in 2-d array

Given a 2D matrix of size N*M. The task is to find the maximum product path from (0, 0) to (N-1, M-1). You can only… Read More »

## Sum of non-diagonal parts of a square Matrix

Given a square matrix of size N X N, the task is to find the sum of all elements at each portion when the matrix… Read More »

## Java Program to Add two Matrices

Given two matrices A and B of same size, the task to add them in Java. Examples: Input: A[][] = {{1, 2}, {3, 4}} B[][]… Read More »

## Java Program to Multiply two Matrices of any size

Given two matrices A and B of any size, the task to multiply them in Java. Examples: Input: A[][] = {{1, 2}, {3, 4}} B[][]… Read More »

## Program to print the Diagonals of a Matrix in O(N) time

Given a 2D square matrix, the task is to print the Principal and Secondary diagonals of this matrix in O(N) time complexity. For O(N2) time,… Read More »

## Program to find the Product of diagonal elements of a matrix

Given an N * N matrix, the task is to find the product of the elements of left and right diagonal. Examples: Input: arr[] =… Read More »

## Maximum sum path in a Matrix

Given an n*m matrix, the task is to find the maximum sum of elements of cell starting from the cell (0, 0) to cell (n-1,… Read More »

## Count of odd length contiguous Palindromic sequences in a Matrix

Given a matrix arr[][] of size MxN, the task is to find the number of contiguous palindromic sequences of odd length in that matrix. Example:… Read More »

## Making all elements of matrix equal to a given element K

Given a 2-d array arr[][], the task is to check whether it is possible to make all elements of the array to equal to a… Read More »

## Number of square matrices with all 1s

Given an N*M matrix containing only 0s and 1s, the task is to count the number of square submatrices containing all 1s. Examples: Input: arr[][]… Read More »

## Finding the Frobenius Norm of a given matrix

Given an M * N matrix, the task is to find the Frobenius Norm of the matrix. The Frobenius Norm of a matrix is defined… Read More »

## Find Maximum Length Of A Square Submatrix Having Sum Of Elements At-Most K

Given a N x M matrix where N is the number of rows and M is the number of columns in the given matrix and… Read More »

## Find Number of Even cells in a Zero Matrix after Q queries

Given a Zero matrix of N x N size, the task is to find the numbers of cells containing even numbers after performing Q queries.… Read More »

## Largest row-wise and column-wise sorted sub-matrix

Given an N * M matrix mat[][], the task is to find the area-wise largest rectangular sub-matrix such that each column and each row of… Read More »