DevPrep

All topics › Real interview tasks

Parallel loading with request deduplication and preserved order

Senior PRO

Task

You have a list of image URLs (possibly with duplicates). You must:

  1. Load them in parallel.
  2. Download the same URL only once, even if it's requested concurrently from different places.
  3. Return the results in the original order.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store