Clarification if the problem

I need expected of the test case of the problem ROTATION. I know it’s an ongoing competion but I am just asking for a explanation of the test cases. Thank you.

1 Like

Input:
N=5 M=5

  • A[1]=5 A[2]=4 A[3]=3 A[4]=3 A[5]=9
  • R 1 β€”> output the value of the first element of the array that is A[1]=5 so out put is 5
  • C 4 β€”> rotate the given array 4 times in clock wise direction that is:
  • initial β€”> 5 4 3 3 9
  • after 1st rotation β€”> 4 3 3 9 5 (first 5 to last position)
  • after 2nd rotation β€”> 3 3 9 5 4 (first 4 to last position)
  • after 3rd rotation β€”> 3 9 5 4 3 (first 3 to last position)
  • after 4th rotation β€”> 9 5 4 3 3 (first 3 to last position)
  • R 5 β€”> output the value of the fifth element of the array that is A[5]=5 so out put is 3
  • A 3 β€”> rotate the given array 3 times in anti clock wise direction that is:
  • now present array is 9 5 4 3 3
  • after 1st rotation β€”> 3 9 5 4 3 (last 3 to first position)
  • after 2nd rotation β€”> 3 3 9 5 4 (last 3 to first position)
  • after 3rd rotation β€”> 4 3 3 9 5 (last 4 to first position)
  • R 2 β€”> output the value of the second element of the array that is A[2]=3 so out put is 3

Hope this will be helpful to you :slight_smile:

4 Likes