Closed Shiwei-Luo closed 2 years ago
func (this *MyLinkedList) DeleteAtIndex(index int) { cur := this for i := 0; cur != nil; i++ { if i == index-1 { break } cur = cur.Next } if cur != nil && cur.Next != nil { cur.Next = cur.Next.Next } }
It seems that the case that index equals 0 is not taken into account.
@Shiwei-Luo You are right. I have fixed this bug. Please pull the latest code.
It seems that the case that index equals 0 is not taken into account.