Suppose the following code is written to reverse the contents in an array, explain why it is wrong. How do you fix it?
int[] list = {1, 2, 3, 5, 4};
for (int i = 0, j = list.length - 1; i
// Swap list[i] with list[j]
int temp = list[i];
list[i] = list[j];
list[j] = temp;
}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.