Uber SDE Interview Question 2023 July | Arrays and Hashing | on-campus
Uber · Question · Posted Jun 2026
Question 1 Problem Statement Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. Constraints 0 <= nums.length <= 105 -109 <= nums[i] <= 109 Examples Example 1: Input: nums = [100, 4, 200, 1, 3, 2] Output: 4 Explanation 1: The longest consecutive sequence is [1, 2, 3, 4]. It has length 4. Elements 100 and 200 are isolated — no neighbours exist ...
The full answer & interview discussion are available to premium members.
Log in Create a free account