ByteDance interview question

remove duplicates from sorted list