Which optimized sorting/searching pattern solves this lesson cleanly?

Practice this question from Merge Intervals - Sort and Sweep Pattern Practice Quiz, with options and an explanation.

Question

Which optimized sorting/searching pattern solves this lesson cleanly?

Option A — Correct answer

Sort by start, then sweep and merge with the last interval.

Option B

Plain nested loops without using order

Option C

Recursive DFS on tree nodes

Option D

Character frequency counting only

Explanation

Sort by start, then sweep and merge with the last interval.

Merge Intervals - Sort and Sweep Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker