← back to unit
Challenge
# sorting advanced
The Bookshelf Reunion
You and your cousin compare your (already sorted) bookshelves to find the books you BOTH own. 📚
You get sorted list a and sorted list b (no repeats within a shelf). Walk both lists together — no nested loops! Print the shared values in order, space-separated, or none.
Example:
Input: a = [1, 3, 5, 8], b = [2, 3, 8, 9]
Output: 3 8
Walking both sorted lists with two fingers, 3 matches on both sides and 8 matches on both sides — those are the shared books.
💡 need a hint?
sort-bookshelf-reunion.py🔒 given lines are locked — write your code in between
loading...