Remove duplicates in-place