Algorithm · Capital One · Easy
You are given an integer array nums. Split it, from left to right, into consecutive groups of two that do not share any element: the first group is (nums[0], nums[1]), the second is (nums[2], nums[3]), and so forth. Within each such group, rearrange the two values so that the smaller one (or either one, if they are equal) comes first, i.e. each pair ends up in nondecreasing order. When nums has an odd number of elements, the last element has no partner; leave it exactly…