Introduction
It is an easy level array algorithm. It took me over five minutes to come out the idea how to solve the problem, I thought about counting how many distinct numbers first, and then put all distinct numbers in the front or in the end. I think that it is ok to move the end and then move back to the front.
My practice
I checked the discuss and found the easy solution. I wrote one as well. Here is the solution.
No comments:
Post a Comment