Maximal Binary Plot Problem
Maximal Binary Plot Problem — ExecCode Hard DSA Practice
Solve the Maximal Binary Plot problem on ExecCode. Free online hard DSA practice in Stacks & Queues. Write and run code in Java, C++, Python — no signup required to run.
Problem description
A binary matrix is a city grid of empty (0) and occupied (1) cells. You must choose an axis-aligned rectangle made only of ones. Return the maximum number of cells in a rectangle containing only ones. If there is no one, return 0. You are given: matrix — rows of 0/1 integers Return integer area. Ones need not form a square. A single 1 is a valid rectangle of area 1.
Examples
Input {'matrix': [[1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 1, 1, 1, 1], [1, 0, 0, 1, 0]]}; Output 6. Input {'matrix': [[0, 1], [1, 0]]}; Output 1. Input {'matrix': [[0, 0], [0, 0]]}; Output 0
Constraints
matrix[i][j] is 0 or 1
Practice Maximal Binary Plot free on ExecCode. Browse DSA problems, topic map, and placement guides.