Relative Content

Tag Archive for pythonalgorithmdata-structureslinked-listdoubly-linked-list

Design Doubly Linked List

I am currently stuck on Leetcode 707: Design a linked list, I think I have it mostly down but I am only passing 62/65 testcases. The problem seems to be with the deleteAtIndex function when I try to delete from index 0. I am using the 2 dummy doubly linked list approach. I thought my logic is correct, because if the index is already 0 it should skip the while loop and simply delete the first node correct? Except I tried testing it on my own and it does not work for some reason, maybe I am missing something simple? Any help would be great, thanks!