Given a matrix mat[][] of R rows and C columns. The task is to find the sum of all elements from the main diagonal which… Read More
Category Archives: Matrix
Given a binary grid[ ][ ] of size N*M, with each cell containing either 0 or 1, where 1 represents an alive cell and the… Read More
Given a matrix A[][] of dimension N*M, the task is to find the minimum number of moves required to traverse the entire matrix starting from… Read More
Given a matrix A[][] of size N*M, the task is to check if the given matrix satisfies the following two conditions or not: Sum of… Read More
Given two positive integers N and C. There is a 2*N matrix where each cell of the matrix can be colored in 0 or 1.… Read More
Given an integer N, the task is to find the N-th Fibonacci numbers.Examples: Input: N = 3 Output: 2 Explanation: F(1) = 1, F(2) = 1 F(3) = F(1)… Read More
Given a matrix mat[][], the task is to check whether the sum of the elements of the matrix is prime or not. Examples: Input: mat[][]… Read More
Given a grid of size N*M consists of 0 and 1 only, the task is to find the length of longest connected 1s in the… Read More
Given four positive integers M, N, X, and Y, the task is to count all the possible ways to reach from the top left(i.e., (0,… Read More
Given an integer matrix mat [ ][ ] dimensions, the task is to find the largest possible square matrix from the given matrix with maximum… Read More
Given a binary matrix mat[][] of size NxM and two integers X and Y, the task is to find the minimum number steps required to… Read More
Given a matrix A[][] consisting of coordinates of N rectangles such that {A[i][0], A[i][1]} representing bottom left coordinate of rectangle and {A[i][2], A[i][3]} representing top… Read More
Given an N * M matrix and a starting position (X, Y) of a virus, the task is to find out the number of covered… Read More
Given a matrix mat[][] of dimensionM*N, the task is to find the total maximum possible value must be increased to each cell(say mat[i][j]) such that… Read More
Given a matrix mat[][] with N rows and M columns. The task is to find the minimum number of changes required in the matrix such… Read More