Spiral print of 2D matrix

for an array of large rows and columns we have to do a large no. of if else and for loops that’s not an optimum solution kindly provide so.

Hey @tarunpal703_521984d8d0d2878c Since If else only takes O(1) so it will not be problem and they are necessary for the question and the solution that mam gave is totally optimised to max strength.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.