Warner Bros. Discovery interview question

Remove duplicates in constant space