Frage im Vorstellungsgespräch bei Ex Libris

Debug this code, (it was a function which gave distinct values of an array)