Company: Walmart_12march
Difficulty: medium
Array Rotation After K Seconds Problem Description You are given an array A of 'N' positive integers. The array has a special property of rotating itself every second. For every odd second the array left rotates 2 positions and for every even second of time, the array right rotates 3 positions. You need to find the array after 'K' seconds. Input Format First line of input contains a positive integer 'N' and 'K' , denoting the size of array and the number of seconds. Second line of input contains N space separated integers, denoting elements of array. Output Format Output the array after K seconds. Constraints 1 <= N, K <= 10^5 1 <= A[i] <= 10^5 Examples Example 1: Input: 6 5 4 32 3 9 16 32 Output: 4 32 3 9 16 32 Explanation: After 1 second, A will left rotate 2 positions, thus A = [3,9,16,32,4,32]. After 2 seconds, Now A will right rotate 3 positions, thus A = [32, 4, 32, 3, 9, 16]. After 3 seconds, A will now left rotate 2 positions, thus A = [32, 3, 9, 16, 32, 4]. After 4