Company: Valuelabs_8thaug
Difficulty: easy
Anti-Spiral Traversal of a Matrix Problem Description You are given a matrix with M rows and N columns. The spiral order of the matrix is obtained by walking the matrix clockwise from the top-left corner: first the whole top row from left to right, then the rightmost remaining column from top to bottom, then the bottom remaining row from right to left, then the leftmost remaining column from bottom to top, and so on inward until every cell has been visited exactly once. The anti-spiral order is the spiral order written backwards. Print the elements of the matrix in anti-spiral order. Input Format The first line contains two space-separated integers M and N — the number of rows and the number of columns. Each of the next M lines contains N space-separated integers — the rows of the matrix. Output Format Print all M × N elements in anti-spiral order on a single line, separated by single spaces. Constraints 1 <= M <= 35 1 <= N <= 35 -10^9 <= matrix[i][j] <= 10^9 All valu