I don’t understand the solution, Please explain me this one.
I even returned the size of the set by inserting elements into set which was also wrong.
I don’t understand the solution, Please explain me this one.
I even returned the size of the set by inserting elements into set which was also wrong.
Hey @cbcao263
Your soln looks incomplete
So basically logic behind this quest is
Say array is 0 0 1 1 2 2
Now when we get a new distinct element when a[i]!=a[i-1] Here a[2]!=a[1] and a[4]!=a[3]
So we return 2+1 at last because a[1] a[2] and a[4] all are different