The delete function leaks the pointer being deleted!
I suggest using ‘delete currentNode;’ before ‘return deleted;’
Type your question above this line.
Course: https://www.educative.io/collection/5642554087309312/5646276079124480
Lesson: https://www.educative.io/collection/page/5642554087309312/5646276079124480/5152192772177920