diff --git a/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README.md b/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README.md index 387c2e1b0fb20..6dc79846ae2c2 100644 --- a/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README.md +++ b/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README.md @@ -176,7 +176,7 @@ public: // pub left: Option>>, // pub right: Option>>, // } -// +// // impl TreeNode { // #[inline] // pub fn new(val: i32) -> Self { @@ -293,10 +293,10 @@ func flatten(root *TreeNode) { Do not return anything, modify root in-place instead. */ function flatten(root: TreeNode | null): void { - while (root != null) { - if (root.left != null) { + while (root !== null) { + if (root.left !== null) { let pre = root.left; - while (pre.right != null) { + while (pre.right !== null) { pre = pre.right; } pre.right = root.right; diff --git a/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README_EN.md b/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README_EN.md index d28488943419c..4a7e406cae59d 100644 --- a/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README_EN.md +++ b/solution/0100-0199/0114.Flatten Binary Tree to Linked List/README_EN.md @@ -152,7 +152,7 @@ public: // pub left: Option>>, // pub right: Option>>, // } -// +// // impl TreeNode { // #[inline] // pub fn new(val: i32) -> Self { @@ -269,10 +269,10 @@ func flatten(root *TreeNode) { Do not return anything, modify root in-place instead. */ function flatten(root: TreeNode | null): void { - while (root != null) { - if (root.left != null) { + while (root !== null) { + if (root.left !== null) { let pre = root.left; - while (pre.right != null) { + while (pre.right !== null) { pre = pre.right; } pre.right = root.right; diff --git a/solution/0100-0199/0114.Flatten Binary Tree to Linked List/Solution.ts b/solution/0100-0199/0114.Flatten Binary Tree to Linked List/Solution.ts index 0e96467d16ca8..51d3957ccdc5d 100644 --- a/solution/0100-0199/0114.Flatten Binary Tree to Linked List/Solution.ts +++ b/solution/0100-0199/0114.Flatten Binary Tree to Linked List/Solution.ts @@ -16,10 +16,10 @@ Do not return anything, modify root in-place instead. */ function flatten(root: TreeNode | null): void { - while (root != null) { - if (root.left != null) { + while (root !== null) { + if (root.left !== null) { let pre = root.left; - while (pre.right != null) { + while (pre.right !== null) { pre = pre.right; } pre.right = root.right;