struct ListNode* deleteNode(struct ListNode* head, int val ) {
if(head==NULL){
return NULL;
}
struct ListNode* pre=NULL;
struct ListNode* node=head;
struct ListNode* next=head->next;
while(node){
int cur_val=node->val;
if(cur_val==val){
if(pre!=NULL){
pre->next=next;
}else{
head=next;
}
break;
}else{
pre=node;
node=next;
if(next){
next=next->next;
}
}
}
return head;
}