SarthakKeshari / Java-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
46 stars 95 forks source link

Java code to display boundary sorted matrix(modified)(admins choice) #436

Closed Prithijit07 closed 2 years ago

Prithijit07 commented 2 years ago

Issue Id you have worked upon -

269

Briefly explain your program logic -

We first enter the number of rows and columns. We then enter the elements respectively row-wise. We then check if the each column for the element zero, whichever column has the element zero even once we sort that column in ascending order else in descending order. We again check each row in the original matrix for zero, whichever row has the element zero even once we sort that row in ascending order else in descending order(modify the already modified matrix but take the original one as a reference). Then we finally display the matrix.

Screenshots(Attach 2 screenshots of your own input and output) -

image


Checklist:

Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your code for merging -