From 06ed4a5686f3f1c68a851afb76d6cceb81eda69d Mon Sep 17 00:00:00 2001 From: Mohammadjafari80 Date: Thu, 4 Feb 2021 23:45:36 +0330 Subject: [PATCH] fix condition of Add --- data-structures/linked-list/linked_list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data-structures/linked-list/linked_list.go b/data-structures/linked-list/linked_list.go index 669e8cb..fd3fd4c 100644 --- a/data-structures/linked-list/linked_list.go +++ b/data-structures/linked-list/linked_list.go @@ -79,7 +79,7 @@ func (l *List) Add(value interface{}, index int) error { return nil } - if l.Len()-1 == index { + if l.Len() == index { l.Append(value) return nil }