← All problemsSign in

Perfect Arrays

Chef is very fond of arrays which contain the same numbers entirely. He has an array of $N$ numbers. Since he selected the numbers in a hurry, not all the numbers are the same. Chef would like to fix his array by changing some of the numbers. Chef can change any number in his array to any positive integer. Chef thinks the array is perfect if the number of indices $i$ ($1$ ≤$ i$ $i$ ≠ $A$$i+1$ is

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