try doing the same with 2X2 matrix i.e r1=1,2
r2=3,4
This solution is wrong
output should be 1,2,4,3 but this gives 1,2,4
@namanmittal0007 at line 26 it should be if(endRow>=startRow) and same for line 35. I think sir forgot equality sign there.
thanks, it worked this way.