Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
Arrays Hash Sorting

Maximum area rectangle by picking four sides from array

Given an array of n positive integers that represent lengths. Find out the maximum possible area whose four sides are picked from given array. Note that a rectangle ...
Matrix square-rectangle Matrix

Find all rectangles filled with 0

We have one 2D array, filled with zeros and ones. We have to find the starting point and ending point of all rectangles filled with 0. It is given that rectangles are...
Hash Matrix cpp-unordered_map

Find if there is a rectangle in binary matrix with corners as 1

There is a given binary matrix, we need to find if there exists any rectangle or square in the given matrix whose all four corners are equal to 1. Examples: Input : m...
Matrix square-rectangle Matrix

Create a matrix with alternating rectangles of O and X

Write a code which inputs two numbers m and n and creates a matrix of size m x n (m rows and n columns) in which every elements is either X or 0. The Xs and 0s must ...
Arrays Matrix Directi

Find the largest rectangle of 1’s with swapping of columns allowed

Given a matrix with 0 and 1’s, find the largest rectangle of all 1’s in the matrix. The rectangle can be formed by swapping any pair of columns of give...
Matrix Stack Amazon

Maximum size rectangle binary sub-matrix with all 1s

Given a binary matrix, find the maximum size rectangle binary-sub-matrix with all 1’s. Example: Input : 0 1 1 0 1 1 1 1 1 1 1 1 ...
Arrays Dynamic Programming Matrix

Maximum sum rectangle in a 2D matrix DP-27

Given a 2D array, find the maximum sum subarray in it. For example, in the following 2D array, the maximum sum subarray is highlighted with blue rectangle and sum of...

Subscribe to Our Newsletter