1
0
mirror of https://github.com/SunnyQjm/algorithm-review.git synced 2026-06-05 15:39:29 +08:00

Update 3_remove-duplicates-from-sorted-list.py

This commit is contained in:
2020-06-20 21:38:38 +08:00
committed by GitHub
parent 2eccdad20a
commit dae841e79e
@@ -37,6 +37,8 @@ class Solution:
1. 用两个指针,pre指向当前遍历节点的前一个节点,cur指向当前节点;
2. 用last记录上一次访问的数字;
3. 每次查看当前值和上一次访问的数字是否相同,相同则执行删除节点操作,不相同则更新last和两个指针
(讲真,感觉last有点冗余hhh,直接pre.val好像可以替代last
"""
if not head:
return None