Previous Next
0 / 15
Module DEMO-33-66DEMO-OOP-33

Rotate Array Left Once

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read five integers into an array, rotate the array left by one position, and print the result.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. first value
  2. second value
  3. third value
  4. fourth value
  5. fifth value

Output Format

Print the exact report in this order:

  1. Rotated

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
1
2
3
4
5
Rotated: 2 3 4 5 1
Input: first value = 1, second value = 2, third value = 3, fourth value = 4, fifth value = 5.
Key calculation(s): values = {1, 2, 3, 4, 5} | first = values[0] | "Rotated: " + rotated.toString() = "Rotated: 2 3 4 5 1".
Output:
Rotated: 2 3 4 5 1
Sample #2
Public sample
9
8
7
6
5
Rotated: 8 7 6 5 9
Input: first value = 9, second value = 8, third value = 7, fourth value = 6, fifth value = 5.
Key calculation(s): values = {9, 8, 7, 6, 5} | first = values[0] | "Rotated: " + rotated.toString() = "Rotated: 8 7 6 5 9".
Output:
Rotated: 8 7 6 5 9

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings