Leedcode—Remove Linked List Elements 2.0

Table of contents

topic:

Idea analysis:

Code:


topic:

Idea analysis:


1. Traverse the original linked list, take out the nodes that are not val and insert them into the new linked list

2. If the last number is to be deleted, point the next of the previous data to NULL—use 38 and 39 lines of code for processing  


Code:

Guess you like

Origin blog.csdn.net/qq_58286439/article/details/130398747