Remove all elements from a linked list of integers that have value val.
Example Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6 Return: 1 –> 2 –> 3 –> 4 –> 5
Credits: Special thanks to @mithmatt for adding this PRoblem and creating all test cases.
Subscribe to see which companies asked this question.
遍歷鏈表刪除對應節點,注意刪除首節點,尾節點,最后刪除后為NULL的場景
新聞熱點
疑難解答