From 1a037380a095ce622a6bdcad1d1b8417b293e0b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=81=E5=AE=A2=E5=AD=A6=E4=BC=9F?= Date: Fri, 10 Dec 2021 13:33:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E4=BA=8C=E5=8F=89?= =?UTF-8?q?=E6=A0=91=E7=90=86=E8=AE=BA=E5=9F=BA=E7=A1=80=E7=AF=87=20Swift?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/二叉树理论基础.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/problems/二叉树理论基础.md b/problems/二叉树理论基础.md index dab434e6..411e7e22 100644 --- a/problems/二叉树理论基础.md +++ b/problems/二叉树理论基础.md @@ -227,6 +227,21 @@ function TreeNode(val, left, right) { } ``` +Swift: +```Swift +class TreeNode { + var value: T + var left: TreeNode? + var right: TreeNode? + init(_ value: T, + left: TreeNode? = nil, + right: TreeNode? = nil) { + self.value = value + self.left = left + self.right = right + } +} +``` -----------------------