Tap here to switch tabs
Problem
Submissions

Problem: Check if an Array Is Consecutive

Check if an Array Is Consecutive asks whether an integer array contains every number from its minimum through the consecutive value determined by its length, returning true or false.

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

Check if an Array Is Consecutive asks whether an integer array contains every number from its minimum through the consecutive value determined by its length, returning true or false.

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