Doublettes are being created in the array because the code is not checking for duplicates before adding elements. To solve this issue, we can use the...