Array
3731. Find Missing Elements
The endpoints do the work here: the problem promises the smallest and largest of the original range are still in nums, so the range is fixed at [min, max] and every integer strictly inside it that the array doesn't contain is missing. I never have to reconstruct where the range starts or ends — min_element and max_element hand me both.
Loading…