We should consider the repetition


we will first sort the vector
then we will run a loop
for(int i =0;i<A.size();i++)

consider the repetition
while(i +1<A.size() and A[i]==A[i+1]
now work on real situation
if(A[i]== A.size()-1-i)
return 1;

then if we come out of loop
return -1;


Thank you so much explaining the code :slightly_smiling_face: