Java-Questions-and-Solutions icon indicating copy to clipboard operation
Java-Questions-and-Solutions copied to clipboard

Maximum Size Rectange

Open vish-han opened this issue 4 years ago • 14 comments

Enter your question -

Given a binary matrix M of size n X m. Find the maximum area of a rectangle formed only of 1s in the given matrix.

Enter link to the question(if question belongs to any online platform) -

NA

Tags for the question(eg - Array, Basic, Stack, etc.) -

Matrix ,2D Array

vish-han avatar Oct 05 '21 08:10 vish-han

@SarthakKeshari please assign this issue to me..

vish-han avatar Oct 05 '21 17:10 vish-han

@vish-han, I wish to add to this question. May I?

SarthakKeshari avatar Oct 05 '21 18:10 SarthakKeshari

No problem go ahead

vish-han avatar Oct 05 '21 19:10 vish-han

@vish-han, Question updated

Enter your question -

Given a binary matrix M of size n X m. Find the area of a rectangle formed only of 1s in the given matrix and area of a rectangle formed only of 0s in the given matrix. Print the maximum one between the two along with the co-ordinates(top-left, top-right, bottom-left, bottom-right) of the maximum area rectangle.

In case of equal area go with anyone.

Sample Test case Input - 5 6 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0

Output - Maximum area is formed by 0's and is 4x4 = 16 Top-left: 1, 2 Top-right: 1, 5 Bottom-left: 4, 2 Bottom-right: 4, 5

Ouput should have the exact format as presented above

Enter link to the question(if question belongs to any online platform) -

NA

Tags for the question(eg - Array, Basic, Stack, etc.) -

Matrix ,2D Array

SarthakKeshari avatar Oct 05 '21 19:10 SarthakKeshari

@vish-han, Kindly add your solution to "Arrays/2D Arrays" folder. Also mention "(admin_choice)" in filename and PR title. Deadline - 07/10/2021

SarthakKeshari avatar Oct 05 '21 19:10 SarthakKeshari

@SarthakKeshari CAN U PLEASE ASSIGN THISISSSUE TO SOMEONE ELSE, IM UNABLE TO SOLVE THIS QUESTION?

vish-han avatar Oct 06 '21 08:10 vish-han

Do you wish to leave this issue?

SarthakKeshari avatar Oct 06 '21 08:10 SarthakKeshari

Yess

vish-han avatar Oct 06 '21 08:10 vish-han

Done

Yess

SarthakKeshari avatar Oct 06 '21 09:10 SarthakKeshari

Kindly assign me this issue sir...i think i can solve it. But can you please clarify me how you count the top left-top right co-ordinates....this is the only part i'm unable to understand. please clarify it to me once so that i can make a contribution.

Harsh-bartariya avatar Oct 07 '21 10:10 Harsh-bartariya

@Harsh-bartariya, Example - 1 2 3 4 5 6 7 8 9

So here, cell no. 1 will form top-left, co-ordinates (0,0) cell no. 3 will form top-right, co-ordinates (0,2) cell no. 7 will form bottom-left, co-ordinates (2,0) cell no. 9 will form bottom-right, co-ordinates (2,2)

SarthakKeshari avatar Oct 07 '21 11:10 SarthakKeshari

okk sir thank you...i will work on that

Harsh-bartariya avatar Oct 07 '21 16:10 Harsh-bartariya

@Harsh-bartariya, Kindly add your solution to "Arrays/2D Arrays" folder. Also mention "(admin-choice)" word in your filename and PR title. Deadline - 09/10/2021

SarthakKeshari avatar Oct 07 '21 16:10 SarthakKeshari

Please assign this issue to me.

GayatriChaudhari1281 avatar Oct 31 '21 10:10 GayatriChaudhari1281