Skip to content

Category Archives: Matrix

Given two positive integers N and X, the task is to count the occurrences of the given integer X in an N-length square matrix generated… Read More
Given a lower triangular matrix Mat[][], the task is to store the matrix using row-major mapping. Lower Triangular Matrix: A Lower Triangular Matrix is a… Read More
Given a matrix mat[][] of dimensions N * M, and an integer K, the task is to find the maximum sum of any rectangle possible… Read More
Given a binary matrix mat[][] of dimension N*M, the task is to check if all 1s in each row are placed adjacently on the given… Read More
Given a matrix M[][] of dimension 2*N, the task is to find the minimum cost to fill the matrix with tiles of dimension 2 *… Read More
Given a square matrix mat[][] of size N * N, the task is to calculate XOR value of every diagonal elements and find the Kth… Read More
Given a square matrix mat[][] of dimension N*N, convert the elements present in both the diagonals to their respective binary representations and perform the following… Read More
Given a binary matrix of dimensions N * M, the task is to find the indices of the matrix such that traversal of the given… Read More
Given a matrix A[][] of size N*M and a 2D array Q[][] consisting of queries of the form {X, K}, the task for each query… Read More
Given a matrix grid[][] of size N x N, the task is to find the minimum cost required to reach the bottom right corner of… Read More
Given a matrix mat[][] of dimensions N * M, the task is to minimize the number of increments of matrix elements required to make the… Read More
Prerequisite: Kadane’s algorithm Given a 2D array arr[][] of dimension N*M, the task is to find the maximum sum sub-matrix from the matrix arr[][]. Examples:… Read More
Given a matrix M[][] of dimension N*N, the task is to check if all the elements on the principal and cross diagonals of the matrix… Read More
Given a matrix A[][] of dimensions M × N, the task is to find the maximum sum possible from a matrix by repeatedly selecting two… Read More
Given a square matrix mat[][] of dimension N, the task is to find the determinant of the matrix using the pivot condensation method. Examples: Input:… Read More