Find length of the largest subarray with contiguous elements
Given an array of distinct integers, find length of the longest subarray which contains numbers that can be arranged in a continuous sequence. If the array does not contain the unique elements then we will have to filter the duplicate elements first.
- Sort the given array
- Iterate through the sorter array and keep track of the longest subarray with continuous elements in another array
- Return the maximum number in the result array
O (n long n)