chore(i8n,learn): processed translations
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
15047f2d90
commit
e5c44a3ae5
@ -1,18 +1,18 @@
|
||||
---
|
||||
id: 587d8259367417b2b2512c83
|
||||
title: 反转二叉树
|
||||
title: Invert a Binary Tree
|
||||
challengeType: 1
|
||||
videoUrl: ''
|
||||
forumTopicId: 301704
|
||||
dashedName: invert-a-binary-tree
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
这里我们将创建一个反转二叉树的函数。给定二叉树,我们希望生成一个新树,它等效于该树的镜像。与原始树的inorder遍历相比,在倒置树上运行inorder遍历将以相反的顺序探索节点。在我们的二叉树上编写一个名为`invert`的方法。调用此方法应该反转当前树结构。理想情况下,我们希望在线性时间内就地执行此操作。也就是说,我们只访问每个节点一次,我们在不使用任何额外内存的情况下修改现有的树结构。祝你好运!
|
||||
Here will we create a function to invert a binary tree. Given a binary tree, we want to produce a new tree that is equivalently the mirror image of this tree. Running an inorder traversal on an inverted tree will explore the nodes in reverse order when compared to the inorder traversal of the original tree. Write a method to do this called `invert` on our binary tree. Calling this method should invert the current tree structure. Ideally, we would like to do this in-place in linear time. That is, we only visit each node once and we modify the existing tree structure as we go, without using any additional memory. Good luck!
|
||||
|
||||
# --hints--
|
||||
|
||||
存在`BinarySearchTree`数据结构。
|
||||
The `BinarySearchTree` data structure should exist.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -26,7 +26,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
二叉搜索树有一个名为`invert`的方法。
|
||||
The binary search tree should have a method called `invert`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -42,7 +42,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
`invert`方法正确地反转树结构。
|
||||
The `invert` method should correctly invert the tree structure.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -70,7 +70,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
反转空树返回`null` 。
|
||||
Inverting an empty tree should return `null`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -160,7 +160,7 @@ function Node(value) {
|
||||
function BinarySearchTree() {
|
||||
this.root = null;
|
||||
// Only change code below this line
|
||||
|
||||
|
||||
// Only change code above this line
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user