diff --git a/Linked List 1/AppendLastNToFirst.cpp b/Linked List 1/AppendLastNToFirst.cpp index ca9f4c2..a3142af 100644 --- a/Linked List 1/AppendLastNToFirst.cpp +++ b/Linked List 1/AppendLastNToFirst.cpp @@ -68,7 +68,7 @@ Node *appendLastNToFirst(Node *head, int n){ //corner case if(n == 0 or head == NULL) { return head; - } + Node *tail = head; Node *ptr = head; @@ -79,7 +79,7 @@ Node *appendLastNToFirst(Node *head, int n){ tail = tail -> next; length++; } - + int counter = 1; while(counter < length - n) { diff --git a/README.md b/README.md index 7d162c2..cf96f10 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # Data_Structure_CodingNinjas.com -These are my solutions to the Data Structure and Algorithm Course on CodingNinjas.com using C++. +These are my solutions to the Data Structure and Algorithm Course on CodingNinjas.com using C++