You are viewing a single comment's thread. Return to all comments →
Can someone tell me what is wrong with my code, case 6 failing idk why
public static int runningTime(List<Integer> arr) { int shifts=0, i, j; for(i=0;i<arr.size()-1;i++) { for(j=i+1;j<arr.size();j++) { if(arr.get(j)<arr.get(i)) { int temp=arr.get(j); arr.set(j,arr.get(i)); arr.set(i,temp); shifts++; } } } return shifts; }
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 →
Can someone tell me what is wrong with my code, case 6 failing idk why