倒置数组

public static void reverse(int[] a) {
    int low = 0, high = a.length - 1;
    for (; low < high; low++, high--) {
        int temp = a[low];
        a[low] = a[high];
        a[high] = temp;
    }
}


Previous     Next
ponxu /
Categories 算法  Tags 算法