逻辑Logic iOS 底层大师班2期班
private int partition(int[] nums, int start, int end) {
int pivotValue = nums[end];
int j = start - 1;
for (int i = start; i < end; i++) {
if (nums[i] <= pivotValue) {
j++;
if (i != j) {
swap(nums, i, j);
}
}
}
swap(nums, j + 1, end);
return j + 1;
}