Ruby Array Exercises: Create an array with the elements "rotated left" of a given array of ints length 3
Ruby Array: Exercise-11 with Solution
Write a Ruby program to create an array with the elements "rotated left" of a given array of integers length 3.
def check_array(nums) rotated = nums, nums, nums; return rotated; end print check_array([1, 2, 5]),"\n" print check_array([1, 2, 3]),"\n" print check_array([1, 2, 4])
[2, 5, 1] [2, 3, 1] [2, 4, 1]
Ruby Code Editor:
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework