diff --git a/problems/0203.移除链表元素.md b/problems/0203.移除链表元素.md index 300f98e9..f09c572b 100644 --- a/problems/0203.移除链表元素.md +++ b/problems/0203.移除链表元素.md @@ -27,14 +27,12 @@ 输入:head = [7,7,7,7], val = 7 输出:[] -# 算法公开课 +## 算法公开课 **[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[链表基础操作| LeetCode:203.移除链表元素](https://www.bilibili.com/video/BV18B4y1s7R9),相信结合视频再看本篇题解,更有助于大家对本题的理解**。 -# 思路 - -为了方便大家理解,我特意录制了视频:[链表基础操作| LeetCode:203.移除链表元素](https://www.bilibili.com/video/BV18B4y1s7R9),结合视频在看本题解,事半功倍。 +## 思路 这里以链表 1 4 2 4 来举例,移除元素4。 @@ -91,7 +89,7 @@ 最后呢在题目中,return 头结点的时候,别忘了 `return dummyNode->next;`, 这才是新的头结点 -# C++代码 +### C++代码 **直接使用原来的链表来进行移除节点操作:** @@ -159,7 +157,7 @@ public: ## 其他语言版本 -C: +### C: 用原来的链表操作: ```c @@ -227,7 +225,7 @@ struct ListNode* removeElements(struct ListNode* head, int val){ } ``` -Java: +### Java: ```java /** @@ -308,7 +306,7 @@ public ListNode removeElements(ListNode head, int val) { } ``` -Python: +### Python: ```python (版本一)虚拟头节点法 @@ -334,7 +332,7 @@ class Solution: ``` -Go: +### Go: ```go /** @@ -359,7 +357,7 @@ func removeElements(head *ListNode, val int) *ListNode { } ``` -javaScript: +### JavaScript: ```js /** @@ -381,7 +379,7 @@ var removeElements = function(head, val) { }; ``` -TypeScript: +### TypeScript: 版本一(在原链表上直接删除): @@ -437,7 +435,7 @@ function removeElements(head: ListNode | null, val: number): ListNode | null { }; ``` -Swift: +### Swift: ```swift /** @@ -465,7 +463,7 @@ func removeElements(_ head: ListNode?, _ val: Int) -> ListNode? { } ``` -PHP: +### PHP: ```php /** @@ -493,7 +491,7 @@ func removeElements(head *ListNode, val int) *ListNode { } ``` -RUST: +### Rust: ```rust // Definition for singly-linked list. @@ -531,7 +529,7 @@ impl Solution { } ``` -Scala: +### Scala: ```scala /** @@ -564,7 +562,7 @@ object Solution { } ``` -Kotlin: +### Kotlin: ```kotlin /** @@ -600,7 +598,8 @@ class Solution { } ``` -C# +### C# + ```CSharp /** * Definition for singly-linked list.