Rotate Right By 1 Problem

Rotate Right By 1 Problem — ExecCode School DSA Practice

Solve the Rotate Right By 1 problem on ExecCode. Free online school DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a list of whole numbers. Your task is to move every number one step to the right, and move the last number to the front. Print the new list.

Examples

Input 5 1 2 3 4 5; Output 5 1 2 3 4. Input 1 10; Output 10

Constraints

1 <= N <= 1000 -10^5 <= array[i] <= 10^5

Practice Rotate Right By 1 free on ExecCode. Browse DSA problems, topic map, and placement guides.