Infosys interview question

remove duplicates from sorted array