Solution to Print Matrix from Jobdu

10 Aug

Question (in Chinese):

Question Name: Print Matrix

Question Description: Give an integer matrix, print it in spiral form.

Input: the input might contain multiple test cases. Inside each test case, the first line includes two intergers N and M (0 <= N, M <= 1000), saying the number of rows and columns respectively. The following N lines contain the values of the matrix. 

Output: print the matrix in spiral form. Every number is followed by a space.

The solution is:

Leave a Reply

Your email address will not be published. Required fields are marked *