in the first place.No smart cheater is ever going to paste working code into the solution box. They will do it iteratively, bit by bit, renaming things and moving things around as if they were actually solving it. Also, everyone and their mom has probably done thousands of leetcodes at...
Actually, the code works well not only for appearing twice, but also appearing even times. In next bolg, I will share you will a more general way to handle this kind of question.