Question bank › Arrays
Dsa Arrays Medium

Minimum Set Difference

You are given two arrays of integers. Your task is to find the minimum difference between any element of the first array and any element of the second array. Input Format: - The first line contains an integer n (1 <= n <= 1000), the number of elements in the first array. - The second line contains n integers representing the elements of the first array. - The third line contains an integer m (1 <= m <= 1000), the number of elements in the second array. - The fourth line contains m integers representing the elements of the second array. Output Format: - Output a single integer representing the minimum difference. Example Input: 3 1 5 9 4 10 1 7 4 Example Output: 1

Key concepts

arrayssortinggreedy

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.