We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e59e81 commit 6ce33d6Copy full SHA for 6ce33d6
linkedList/linkedList.js
@@ -49,6 +49,34 @@ class LinkedList {
49
clear() {
50
this.head = null;
51
}
52
+
53
+ removeFirst() {
54
+ if(!this.head) {
55
+ return;
56
+ }
57
58
+ this.head = this.head.next;
59
60
61
+ removeLast() {
62
63
64
65
+ } else if(!this.head.next) {
66
+ previous = null;
67
68
69
70
+ let previous = this.head;
71
+ let node = this.head.next;
72
73
+ while(node.next) {
74
+ previous = node;
75
+ node = node.next;
76
77
78
+ previous.next = null;
79
80
81
82
0 commit comments