SarthakKeshari / CPP-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
47 stars 132 forks source link

added solution for sort and print boundary elements of a 2d matrix #378

Closed Karan0009 closed 2 years ago

Karan0009 commented 2 years ago

Issue Id : #212 Kindly write your answer here

solution:

  1. print the matrix
  2. extract the boundary elements
  3. sort this array
  4. then just replace the boundary elements of the matrix when printing the solution with the elements in the boundary elements array

screenshots of the solution: ss1 ss2

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

Karan0009 commented 2 years ago

Hey @SarthakKeshari , I have added comments in the logical section.

Karan0009 commented 2 years ago

🥳