# Ring Rotate #### Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

`You are given a n*m matrix where n are the number of rows and m are the number of columns. You are also given n*m numbers representing the elements of the matrix.You will be given a ring number 's' representing the ring of the matrix. For details, refer to image. You will be given a number 'r' representing number of rotations in an anti-clockwise manner of the specified ring.You are required to rotate the 's'th ring by 'r' rotations and display the rotated matrix.`
Input Format
`A number nA number me11e12..e21e22.... n * m number of elements of array aA number sA number r`
Output Format
`output is handled by display function`
Question Video
Constraints
`1 <= n <= 10^21 <= m <= 10^2-10^9 <= e11, e12, .. n * m elements <= 10^90 < s <= min(n, m) / 2-10^9 <= r <= 10^9`
Sample Input
`57111213141516172122232425262731323334353637414243444546475152535455565723`
Sample Output
`11 12 13 14 15 16 1721 25 26 36 46 45 2731 24 33 34 35 44 3741 23 22 32 42 43 4751 52 53 54 55 56 57`

• Related Topics

Run

Run
Id Name