contents: proofread

This commit is contained in:
Yangshun
2021-09-02 01:30:39 +08:00
parent 284e6f992f
commit c695750222
14 changed files with 68 additions and 55 deletions

View File

@ -13,7 +13,7 @@ Sum Root to Leaf Numbers is an [interesting problem from LeetCode](https://leetc
<!--truncate-->
I assume that youre familiar with Python and the concept of binary trees. If youre not, you can read [this article](https://www.tutorialspoint.com/python_data_structure/python_binary_tree.htm) to get started.
I assume that you're familiar with Python and the concept of binary trees. If you're not, you can read [this article](https://www.tutorialspoint.com/python_data_structure/python_binary_tree.htm) to get started.
<!--truncate-->
@ -21,7 +21,7 @@ I assume that youre familiar with Python and the concept of binary trees. If
## The Problem
Given a binary tree whose nodes contain values `0-9`, we have to find the sum of all numbers formed by root-to-leaf paths. A leaf is a node that doesnt have any child nodes. **In a binary tree, a root-to-leaf path is always unique**. Here below is the expected behavior of the solution required:
Given a binary tree whose nodes contain values `0-9`, we have to find the sum of all numbers formed by root-to-leaf paths. A leaf is a node that doesn't have any child nodes. **In a binary tree, a root-to-leaf path is always unique**. Here below is the expected behavior of the solution required:
![leetcode2](https://user-images.githubusercontent.com/29497717/82636816-0be5d480-9c36-11ea-8b2d-78bb36c865ee.jpeg)
@ -37,9 +37,9 @@ In the tree on the left, the output is `25`. `25` is the sum of `12` and `13`, w
## The Solution
We can do a `pre-order` traversal of the tree where we incrementally construct a number and exploit the fact that numbers formed by nodes in the same sub-tree have common digits. When were done forming numbers in a sub-tree, we can backtrack and go to another sub-tree.
We can do a `pre-order` traversal of the tree where we incrementally construct a number and exploit the fact that numbers formed by nodes in the same sub-tree have common digits. When we're done forming numbers in a sub-tree, we can backtrack and go to another sub-tree.
Lets create a `Solution` class to encompass our solution.
Let's create a `Solution` class to encompass our solution.
```py
class Solution:

View File

@ -42,7 +42,7 @@ export default React.memo(function SidebarAd() {
}}>
<p className={styles.tagline}>
<strong>Get paid, not played.</strong> Chat with former tech recruiters
wholl guide you on exactly what to say to negotiate a higher offer.
who'll guide you on exactly what to say to negotiate a higher offer.
</p>
</a>
);

View File

@ -93,7 +93,7 @@ function Home() {
<div align="center">
<strong>
Get paid, not played. Chat with former tech
recruiters wholl guide you on exactly what to say
recruiters who'll guide you on exactly what to say
to negotiate a higher offer.
</strong>
</div>