So,,, even if he mean that 2 must be first ,1 second ,8 3rd and 3 4th,,, then lets see steps from input 2 1 2 5 7 1 9 3 6 8 8 arr2[2 1 8 3] 2 ->[2] 1->[2,1] because 1 is after 2 in arr2 2->[2,2,1] or [2,1] depends if he wants/accept same that also didnt clarified. 5->[2,2,1,5] and now arr2->[21835] but if this is the case what will happen if after 5 come 0? will again start from beginning?..because say " add the these elements at the end of the array in sorted fashion" 'Sorted fashion' here mean sorted only for NEW numbers like ar2[21835]->ar2[218305] ???