My Blog List

[Leetcode Solution] Remove Duplicates from Sorted List II

Analysis

  • Add a auxiliary node at the very beginning of the list
  • Iterate all the nodes. At each node, detect if the adjacent following nodes is duplicated. If it is, delete all the duplicated ones. If not, move to next node and do the same

Note

Code


UPDATED AT LEETCODE 2ND PASS

No comments:

Post a Comment

Enter you comment