From 7803388377332c18559fa19296b064aa076a1f1b Mon Sep 17 00:00:00 2001 From: fw_qaq <82551626+Jack-Zhang-1314@users.noreply.github.com> Date: Sat, 5 Nov 2022 14:30:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?update=20=E4=BA=8C=E5=8F=89=E6=A0=91?= =?UTF-8?q?=E7=90=86=E8=AE=BA=E5=9F=BA=E7=A1=80.md=20about=20rust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/二叉树理论基础.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/problems/二叉树理论基础.md b/problems/二叉树理论基础.md index e377626c..d520273a 100644 --- a/problems/二叉树理论基础.md +++ b/problems/二叉树理论基础.md @@ -270,6 +270,29 @@ class TreeNode(_value: Int = 0, _left: TreeNode = null, _right: TreeNode = null) var right: TreeNode = _right } ``` + +rust: + +```rust +#[derive(Debug, PartialEq, Eq)] +pub struct TreeNode { + pub val: i32, + pub left: Option>>, + pub right: Option>>, +} + +impl TreeNode { + #[inline] + pub fn new(val: i32) -> Self { + TreeNode { + val, + left: None, + right: None, + } + } +} +``` +

From 72b6043daa4956cf6d0045e279792f1c35dd78b7 Mon Sep 17 00:00:00 2001 From: fw_qaq <82551626+Jack-Zhang-1314@users.noreply.github.com> Date: Sat, 5 Nov 2022 14:36:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Update=20=E4=BA=8C=E5=8F=89=E6=A0=91?= =?UTF-8?q?=E7=90=86=E8=AE=BA=E5=9F=BA=E7=A1=80.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/二叉树理论基础.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/problems/二叉树理论基础.md b/problems/二叉树理论基础.md index d520273a..03422960 100644 --- a/problems/二叉树理论基础.md +++ b/problems/二叉树理论基础.md @@ -275,15 +275,15 @@ rust: ```rust #[derive(Debug, PartialEq, Eq)] -pub struct TreeNode { - pub val: i32, - pub left: Option>>, - pub right: Option>>, +pub struct TreeNode { + pub val: T, + pub left: Option>>>, + pub right: Option>>>, } -impl TreeNode { +impl TreeNode { #[inline] - pub fn new(val: i32) -> Self { + pub fn new(val: T) -> Self { TreeNode { val, left: None,