Question bank › Hashing
Dsa Hashing Medium

Equi-sum Subarray Match

Given two arrays of integers A and B, find the maximum length L such that there exists a contiguous subarray in A of length L and a contiguous subarray in B of length L that have the same sum. If no such L exists, print 0. Input Format: Line 1: N (size of A). Line 2: N integers of A. Line 3: M (size of B). Line 4: M integers of B. Output Format: Print the maximum length L. Example: Input: 5 1 2 3 4 5 5 9 6 0 0 0 Output: 2 (Explanation: A has [4, 5] sum 9, B has [9, 0] sum 9. Both length 2. No length 3 matches.)

Key concepts

hashingsliding-windowarray-sums

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