var removeElements = function(head, val) {
if(head===null){
return head;
}
let f=new ListNode();
f.next=head;
let s=f;
while(s.next!=null){
if(s.next.val===val){
s.next=s.next.next;
}else{
s=s.next
}
}
return f.next
};
移除链表元素-JS
最新推荐文章于 2022-12-30 15:08:49 发布