← All problemsSign in

Two Arrays

You are given two arrays $A$ and $B$. Both the array follows a special pattern. $A[i]-A[i-1] = m$, for all $i \gt 0$ and $ i \leq A.length-1$. $B[i]-B[i-1] = n$, for all $ i \gt 0$ and $i \leq B.length-1$. $A[0] = B[0]$ Your task is to find the number of common elements in $A$ and $B$. ###Input: - First line will contain $T$, number of testcases. Then the testcases follo

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start