Problem in execution

what is problem in the code

hi @himanshuanand729,
make sure u r preserving the order of no. as given in original list
try
7
1 1 4 2 3 1 2

order should not change ans will be 1 1 3 1 4 2 2

will try doing this and apply this approach