# Category Archives: Matrix

Given a 2D array arr[][] consisting of N*N positive integers, the task is to generate an N-length array such that Greatest Common Divisors(GCD) of all… Read More
Three characters {#, *, . } represents a constellation of stars and galaxies in space. Each galaxy is demarcated by # characters. There can be… Read More
Given a 2D array grid[][] of size N * M, consisting of the characters “1”, “0”, and “*”, where “*” denotes an empty space and… Read More
Given two matrices sudoku[][] and region[][] of size N * N, the task is to fill the given Sudoku on the basis of the given… Read More
Given two integers N and M where N is the number of boxes placed in a row and M is the number of colours of… Read More
Given a source and destination in a matrix[][] of infinite rows and columns, the task is to find whether it is possible to reach the… Read More
Given a square matrix arr[][] of size N consisting of non-negative integers and an integer K, the task is to find the maximum median value… Read More
Given a matrix arr[][] of size NxM and an integer K, the task is to find the count of square submatrices in the given matrix… Read More
Given a matrix arr[][] of dimension M*N consisting of positive integers, where arr[i][j] represents the height of each unit cell, the task is to find… Read More
Given a matrix mat[][] of size N×M where each row of the matrix is a permutation of the elements from [1, M], the task is… Read More
Given a matrix, arr[][] of dimensions M*N, and an integer S, the task is to print the count of the number of subsquares of the… Read More
Given two binary matrices, A[][] and B[][] of size N×M, the task is to find the minimum number of swaps of the elements of matrix… Read More
Given a binary matrix mat[][] of dimensions N*M, the task is to find the minimum number of flips required from the given binary matrix such… Read More
Given a matrix of dimensions N*M consisting of characters ‘M’, ‘#’, ‘.’ and only a single instance of ‘A’. The task is to print any… Read More
Given two 2D matrices mat[][] and T[][] of size M×N and P×Q respectively. The task is to check whether the matrix T[][] is a result… Read More