1416. Check if an Array Is Consecutive

Easy
Array
Hash Table
Sorting

Description

Hints

Hint 1
Try sorting nums.
Hint 2
If nums is consecutive and sorted in ascending order, then nums[i] + 1 = nums[i + 1] for every i in the range 0 ≤ i < nums.length - 1.

Statistics

Acceptance
62.0%
Submissions
12,461
Accepted
7,723