You are viewing a single comment's thread. Return to all comments →
i used this logic but i am getting error on testcase:6
static int runningTime(int[] arr) { int result=0; for(int i=0;i<arr.length;i++) { for(int j=i+1;j<arr.length;j++) { if(arr[i]>arr[j]) { int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; result++; } } } return result; }
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 →
i used this logic but i am getting error on testcase:6