← All problemsSign in

Can you find prime pattern

Given an array $A$, of $N$ integers, In one operation you can choose any 1 <= i <= N and perform either $A[i]$ $+=$ $1$ or $A[i]$ $-=$ $1$. Find the minimum number of operations required so that all array elements are $prime$ numbers. ###Input: - Each testcase contains of first line $N$. - Next line contains array $A$ space seperated. ###Output: For each testcase, output in a single line

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