Skip to content

Commit 73595b9

Browse files
committed
显示判断节点用 is None
1 parent 96f9308 commit 73595b9

File tree

1 file changed

+1
-1
lines changed
  • docs/19_python内置常用算法和数据结构

1 file changed

+1
-1
lines changed

docs/19_python内置常用算法和数据结构/builtins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def gen_tree_from_lc_input(vals_str): # [1,2,3] -> root TreeNode
327327
return None
328328
nodemap = {}
329329
for i in range(len(vals)):
330-
if vals[i] is not None: # 一开始写的 if vals[i],但是 0 节点就错了!!!
330+
if vals[i] is not None: # 一开始写的 if vals[i],但是 0 节点就错了! 应该显示判断是否为 None(空节点)
331331
nodemap[i] = TreeNode(vals[i])
332332
else:
333333
nodemap[i] = None

0 commit comments

Comments
 (0)