Question bank › Hashing
Dsa Hashing Medium

The Rhythm Echo

Two musical sequences are considered 'relative echoes' if the changes between consecutive notes are identical. For example, [10, 12, 15] and [20, 22, 25] are echoes because their differences are both [2, 3]. Given two sequences A and B, find the length of the longest contiguous subsegment of A that has a relative echo in B. Input Format: - Line 1: N M (lengths of sequence A and B). - Line 2: N integers (Sequence A). - Line 3: M integers (Sequence B). Output Format: - A single integer representing the maximum length of the echo subsegment. Example: Input: 4 4 1 2 4 7 10 11 13 16 Output: 4

Key concepts

hashingarrayssliding-window

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.