The direction is right.
You just have to set is_dup to false before the inner loop and set is_dup to true if the inner and outher value match.

btw the inner loop should be
Code:
for (int k=j-1; k>=0; k--)
to optimize the soluton a little you could break the inner loop when a duplicate was found

Kurt