← All problemsSign in

Chirag and Array

Chirag likes arrays. He gets excited whenever he sees an array. One day he saw an array and thought of a question. He has array ARR[ n ] = a1,a2,a3,.....an. All elements of the array are from 1 to n and repetition is allowed. He makes n sets out of the array. The set Si = { ai, ARR[ai], ARR[ ARR[ ai ] ], ....}. All elements of the set Si are unique. Your task is to find the size of the largest

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