Dsa
Two Pointers
Warm-up
Inventory Sync
Two warehouse branches have provided their inventory lists of SKU IDs, both sorted in ascending order. To identify stock overlap, find all SKU IDs that appear in both lists. If a SKU appears multiple times in both lists, include it as many times as the smaller occurrence count.
Input Format:
Two lines of space-separated integers, each representing a sorted list of SKU IDs.
Output Format:
A single line containing the common SKU IDs in ascending order, separated by spaces.
Example:
Input:
1 3 5 7 9
2 3 7 8 10
Output:
3 7
Key concepts
two_pointersarray
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now