- 1 current stop: learning
- 2 upcoming
- 3 upcoming
- 4 upcoming
- 5 upcoming
Finish after stop 5
Stop 1 of 5 · Starting grid: two sorted lanes
Trick to keep in mind+3 XP
Compare the fronts, take the smaller; once one lane empties the rest is free.
Merging two sorted lists needs a comparison only while both still have items. Each comparison sends one item to the output, and when one list runs dry the other is simply copied across. For [1, 2] and [3, 4] the fronts compare as 1/3 and 2/3, then the first list is empty and 3, 4 are appended.
Read it once, then a question tests whether the trick stuck.