insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Rotate an array by one position to the right.

Rotate an array by one position to the right.

Difficulty: Medium

Phase: 6 · Mixed Logical Challenges

XP Reward: 20 XP

Topics: Mixed Logical Challenges, Medium

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Given two sorted arrays, merge them into a single sorted array in O(N+M) time. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: 3 1 3 5 3 2 4 6

Output: 1 2 3 4 5 6

Explanation: Sample execution for input 3 1 3 5 3 2 4 6