did they solve it by any formula?

You can see this:

https://gateoverflow.in/170507/2darray#:~:text=A%202D%20matrix%20is%20a,the%20main%20diagonal%20are%20zero.&text=So%20here%20we%20have%20to,stored%20in%20row%20major%20order.

39 Points

9 Points

7 Points

6 Points