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.
defrunningTime(arr):# Write your code herenewArr=arr;shifts=0forindexinrange(1,len(arr)):count=indexwhilenewArr[count]<newArr[count-1]andcount<=len(arr)-1andcount>0:v1=newArr[count]newArr[count]=newArr[count-1]newArr[count-1]=v1count-=1shifts+=1returnshifts
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Running Time of Algorithms
You are viewing a single comment's thread. Return to all comments →
My Python3 Solution: