You are viewing a single comment's thread. Return to all comments →
here is my solution
public static int runningTime(ArrayList<Integer> a) { int count = 0; for (int i = 1; i < a.size(); i++) { if (a.get(i) < a.get(i - 1)) { int temp = a.get(i); a.set(i, a.get(i - 1)); a.set(i - 1, temp); count++; i = 0; } } return count; }
Running Time of Algorithms
You are viewing a single comment's thread. Return to all comments →
here is my solution