← All problemsSign in

Modulo or Multiply

A function $f(X, Y)$ creates an array $A$ of size $Y$ such that $A[i] = (X*i)\%Y$ and returns the number of unique elements in that array. You are given two integers $M$ and $N$. You have to create another array $B$ of size $N$ such that $B[i] = f(M, M+i)$ where, $1 \leq i \leq N$. Can you tell the maximum size of a prefix subarray of $B$ (subarray starting from $B[1]$) such that its elements are

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