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
Tag Archives: submatrix
What is a Matrix? A matrix is a two-dimensional array that consists of rows and columns. It is an arrangement of elements in horizontal or… Read More
Given a character matrix consisting of O’s and X’s, find the number of submatrices containing only ‘X’ and surrounded by ‘O’ from all sides. Examples:… Read More
Given a matrix mat of N*N (N is a perfect square|) and two points x and y, the task is to return all the elements of the… Read More
Given an N*M matrix Mat[][] containing all distinct integers, the task is to find the minimum area of the matrix (r*c, where 1 ≤ r… Read More
Given a binary matrix mat[][] of dimensions N*M, the task is to find the number of corner rectangles that can be formed. A corner rectangle… Read More
Given a matrix mat[][] of dimensions N*M, the task is to find the size of the largest square submatrix such that the sum of all… 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 mat[][] of size N x M and an array queries[] of size Q, containing (a, b) pairs. The task is to find… 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 positive integer N, the task is to construct a matrix of size N * N such that all the matrix elements are distinct… Read More
Given a binary matrix mat[][] of size M * N and Q queries of the form {pi, pj, qi, qj}, the task for each query… Read More
Given a 2D matrix mat[][] of size N * M and a positive integer K, the task is to find the area of the smallest… Read More
Given a matrix arr[][] of dimensions N * M, the task is to generate a matrix such that any cell (r, c) stores the sum… Read More