Tuesday, August 28, 2018

Leetcode 26: Remove duplicates from sorted array

August 28, 2018

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