mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
Merge pull request #1664 from Jack-Zhang-1314/patch-3
Update 链表理论基础 about rust
This commit is contained in:
@ -218,6 +218,22 @@ class ListNode(_x: Int = 0, _next: ListNode = null) {
|
||||
}
|
||||
```
|
||||
|
||||
Rust:
|
||||
```rust
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
pub struct ListNode<T> {
|
||||
pub val: T,
|
||||
pub next: Option<Box<ListNode<T>>>,
|
||||
}
|
||||
|
||||
impl<T> ListNode<T> {
|
||||
#[inline]
|
||||
fn new(val: T, node: Option<Box<ListNode<T>>>) -> Self {
|
||||
ListNode { next: node, val }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
-----------------------
|
||||
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>
|
||||
|
Reference in New Issue
Block a user