rotate an array by 2 places

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ph sudharani
    New Member
    • Jul 2012
    • 1

    rotate an array by 2 places

    input: array[] = {0,1,2,3,4};
    output should be {3,4,0,1,2};
    can you please help me
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Use a temporary variable to store the value as you swap them out.

    Comment

    Working...