Coders Packet

Playing with Numbers (Java Code)

By Srinivasa V

A Java Code that helps to rotate an array of size n to left, by the number of times provided by the user.

Ryan is given an array of random integers of size n, a number is provided to him along with the array. Help to develop a logic in such a way that it shifts the given array elements by the number of positions towards the left and return the array.

Input specifications:

input1: An integer n indicating the size of array.

input2: Integer array which are elements of the array.

input3: Integer indicating the number of positions the array needs to be rotated.

Output specifications:

Return the updated array after the shift.


Ex 1:









For the given number, ie.2 for above case each element is shifted by2 places to left. and the initial2 elements are required to be shifted from behind, hence array is being rotated.


Download Complete Code


No comments yet

Download Packet

Reviews Report

Submitted by Srinivasa V (srinivasa99v)

Download packets of source code on Coders Packet