# Category Archives: Matrix

Given a binary matrix mat[][] of size m*n (0-based indexing), the task is to return the total number of 1’s in the matrix that follows… Read More
Bellman-Ford Algorithm: The Bellman-Ford algorithm is a single-source shortest-path algorithm that works by iteratively relaxing edges in the graph until the shortest path to all… Read More
Given a matrix of size (n*m) and a point ‘p‘ (x, y). The matrix is given in the form of 0‘s and 1‘s. In one… Read More
Given an N x N matrix of positive integers. The task is to find the shortest path from the first cell of the matrix to… Read More
Geek’s village is represented by a 2-D matrix of characters of size n*m, where H – Represents a houseW – Represents a well. – Represents… Read More
Given two square matrices A and B of size m, where each element can either be 1 or 0, the task is to determine if… Read More
Given an array arr[] of size N, you are standing on origin (0, 0). You are allowed to move arr units in the left direction,… Read More
Given a grid of size M x N and two integers X and Y. A restricted area is defined as the lower left sub-rectangle consisting… Read More
Given Q queries in array A[] of three types of the form {type, X} and an empty array B[], the task for this problem is… Read More
Given an array X[] and a matrix M[][]. Then the task is to output the minimum elements needed to remove so that one row and… Read More
Given a 2-D matrix of characters of size n*m, where H – Represents a house, W – Represents a well, O – Represents an open… Read More
Given a matrix of dimension M * N filled with values 0 (Cell that can be visited), 1 (Starting point), and 2 (Cell that cannot… Read More
Given a matrix A[][] of size N * M columns each element consists of either 0 representing free space and 1 representing wall. In one… Read More
Given a matrix mat[][] of size N x N, the task is to count the number of submatrices with the following properties: The sum of… Read More
Given a matrix arr[][] of size N * M, the task is to find the maximum sum of diagonals for each cell of the matrix… Read More