diff --git a/problems/链表理论基础.md b/problems/链表理论基础.md index 8378f7f2..cdd861fd 100644 --- a/problems/链表理论基础.md +++ b/problems/链表理论基础.md @@ -218,6 +218,22 @@ class ListNode(_x: Int = 0, _next: ListNode = null) { } ``` +Rust: +```rust +#[derive(PartialEq, Eq, Clone, Debug)] +pub struct ListNode { + pub val: T, + pub next: Option>>, +} + +impl ListNode { + #[inline] + fn new(val: T, node: Option>>) -> Self { + ListNode { next: node, val } + } +} +``` + -----------------------