Data Structures19 sections · 729 units
Open in CourseQuiz: Hash Set Usage
Time analysis
Check Your Understanding
In longest consecutive sequence, why do we only start counting when (num-1) is NOT in the set?
- A.To avoid counting duplicates
- B.To ensure we start from the beginning of each sequence, avoiding redundant work
- C.Because num-1 might cause integer overflow
- D.It's an optimization that doesn't affect correctness