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.
I have a question
First I wrote this code which times out
# Enter your code here. Read input from STDIN. Print output to STDOUTn,queries=map(int,input().strip().split())arr=list(map(int,input().strip().split()))#print(arr)for_inrange(queries):q,x,y=map(int,input().strip().split())ifq==1:arr=arr[x-1:y]+arr[:x-1]+arr[y:]else:arr=arr[:x-1]+arr[y:]+arr[x-1:y]print(abs(arr[-1]-arr[0]))print(*arr)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Array and simple queries
You are viewing a single comment's thread. Return to all comments →
I have a question First I wrote this code which times out