Skip to content

Commit 4230bc2

Browse files
authored
feat: update ts solution to lc problem: No.0114 (#1283)
1 parent 2a5fda7 commit 4230bc2

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

solution/0100-0199/0114.Flatten Binary Tree to Linked List/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public:
176176
// pub left: Option<Rc<RefCell<TreeNode>>>,
177177
// pub right: Option<Rc<RefCell<TreeNode>>>,
178178
// }
179-
//
179+
//
180180
// impl TreeNode {
181181
// #[inline]
182182
// pub fn new(val: i32) -> Self {
@@ -293,10 +293,10 @@ func flatten(root *TreeNode) {
293293
Do not return anything, modify root in-place instead.
294294
*/
295295
function flatten(root: TreeNode | null): void {
296-
while (root != null) {
297-
if (root.left != null) {
296+
while (root !== null) {
297+
if (root.left !== null) {
298298
let pre = root.left;
299-
while (pre.right != null) {
299+
while (pre.right !== null) {
300300
pre = pre.right;
301301
}
302302
pre.right = root.right;

solution/0100-0199/0114.Flatten Binary Tree to Linked List/README_EN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public:
152152
// pub left: Option<Rc<RefCell<TreeNode>>>,
153153
// pub right: Option<Rc<RefCell<TreeNode>>>,
154154
// }
155-
//
155+
//
156156
// impl TreeNode {
157157
// #[inline]
158158
// pub fn new(val: i32) -> Self {
@@ -269,10 +269,10 @@ func flatten(root *TreeNode) {
269269
Do not return anything, modify root in-place instead.
270270
*/
271271
function flatten(root: TreeNode | null): void {
272-
while (root != null) {
273-
if (root.left != null) {
272+
while (root !== null) {
273+
if (root.left !== null) {
274274
let pre = root.left;
275-
while (pre.right != null) {
275+
while (pre.right !== null) {
276276
pre = pre.right;
277277
}
278278
pre.right = root.right;

solution/0100-0199/0114.Flatten Binary Tree to Linked List/Solution.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
Do not return anything, modify root in-place instead.
1717
*/
1818
function flatten(root: TreeNode | null): void {
19-
while (root != null) {
20-
if (root.left != null) {
19+
while (root !== null) {
20+
if (root.left !== null) {
2121
let pre = root.left;
22-
while (pre.right != null) {
22+
while (pre.right !== null) {
2323
pre = pre.right;
2424
}
2525
pre.right = root.right;

0 commit comments

Comments
 (0)