We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Enter your code here. Read input from STDIN. Print output to STDOUT#!/bin/usr/rubydefshift_digit(array,i)arr=Array.new()(0..9).eachdo|n|arr.push(n)endtemp=Array.new()len=arr.length(0...len-i).eachdo|y|temp.push(arr[y+i])end(0...i).eachdo|y|temp.push(arr[y])endreturntempenddigits=Array.new()gets.strip.split('').eachdo|n|digits.push(n.to_i)ende=gets.stripe=e.to_iarr=shift_digit(arr,e)digits.eachdo|d|printarr[d]end
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Security Key Spaces
You are viewing a single comment's thread. Return to all comments →
Ruby guys... Maybe?