Algorithms‎ > ‎Array‎ > ‎

Array Circular Shift

Given an integer array. Perform circular right shift by n. 
Give the best solution.

Given: 1 2 3 4 5 6 7

TODO: 6 7 1 2 3 4 5


1. Reverse the array in memory.

    7 6 5 4 3 2 1

2. Reverse at the shift point

    6 7 1 2 3 4 5


Comments