Pergunta de entrevista da empresa Amazon

Remove duplicate entry for a given x from the array in-place and return the length of newly formed such array.