Tap here to switch tabs
Problem
Submissions

Problem: Check if an Array Is Consecutive

med
30 min
Try to solve the Check if an Array Is Consecutive problem.

Statement

Given an integer array nums, return true if nums is consecutive, and false otherwise.

An array is considered consecutive if it contains every number in the range [x,x+n−1][x, x + n - 1] inclusive, where xx is the minimum value in the array and nn is the length of nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check if an Array Is Consecutive

med
30 min
Try to solve the Check if an Array Is Consecutive problem.

Statement

Given an integer array nums, return true if nums is consecutive, and false otherwise.

An array is considered consecutive if it contains every number in the range [x,x+n−1][x, x + n - 1] inclusive, where xx is the minimum value in the array and nn is the length of nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤105\leq 10^5