Longest Consecutive Sequence Problem

Problem Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Examples Example 1: Input: nums = [100,4,200,1,3,2] Output: 4 Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4. ...

Check if Array is Consecutive Integers

Problem Given a array of unsorted numbers, check if all the numbers in the array are consecutive numbers. Examples Example 1: Input: int [] nums = {21,24,22,26,23,25}; Output: True Explanation: All the integers are consecutive from 21 to 26 Example 2: Input: int [] nums = {11,10,12,14,13}; Output: True Explanation: All the integers are consecutive from 10 to 14 ...

Check if Array is Consecutive Positive Integers

Problem Given a array of unsorted numbers, check if all the numbers in the array are consecutive numbers. This problem is special case for Check if Array is Consecutive Integers. Examples Example 1: Input: int [] nums = {21,24,22,26,23,25}; Output: True Explanation: All the integers are consecutive from 21 to 26 Example 2: ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy