Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions solution/2200-2299/2235.Add Two Integers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# [2235. 两整数相加](https://leetcode-cn.com/problems/add-two-integers)

[English Version](/solution/2200-2299/2235.Add%20Two%20Integers/README_EN.md)

## 题目描述

<!-- 这里写题目描述 -->

给你两个整数&nbsp;<code>num1</code> 和 <code>num2</code>,返回这两个整数的和。
<p>&nbsp;</p>

<p><strong>示例 1:</strong></p>

<pre>
<strong>输入:</strong>num1 = 12, num2 = 5
<strong>输出:</strong>17
<strong>解释:</strong>num1 是 12,num2 是 5 ,它们的和是 12 + 5 = 17 ,因此返回 17 。
</pre>

<p><strong>示例 2:</strong></p>

<pre>
<strong>输入:</strong>num1 = -10, num2 = 4
<strong>输出:</strong>-6
<strong>解释:</strong>num1 + num2 = -6 ,因此返回 -6 。
</pre>

<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<ul>
<li><code>-100 &lt;= num1, num2 &lt;= 100</code></li>
</ul>


## 解法

<!-- 这里可写通用的实现逻辑 -->

<!-- tabs:start -->

### **Python3**

<!-- 这里可写当前语言的特殊实现逻辑 -->

```python

```

### **Java**

<!-- 这里可写当前语言的特殊实现逻辑 -->

```java

```

### **TypeScript**

```ts

```

### **...**

```

```

<!-- tabs:end -->
61 changes: 61 additions & 0 deletions solution/2200-2299/2235.Add Two Integers/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# [2235. Add Two Integers](https://leetcode.com/problems/add-two-integers)

[中文文档](/solution/2200-2299/2235.Add%20Two%20Integers/README.md)

## Description

Given two integers <code>num1</code> and <code>num2</code>, return <em>the <strong>sum</strong> of the two integers</em>.
<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>

<pre>
<strong>Input:</strong> num1 = 12, num2 = 5
<strong>Output:</strong> 17
<strong>Explanation:</strong> num1 is 12, num2 is 5, and their sum is 12 + 5 = 17, so 17 is returned.
</pre>

<p><strong>Example 2:</strong></p>

<pre>
<strong>Input:</strong> num1 = -10, num2 = 4
<strong>Output:</strong> -6
<strong>Explanation:</strong> num1 + num2 = -6, so -6 is returned.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
<li><code>-100 &lt;= num1, num2 &lt;= 100</code></li>
</ul>


## Solutions

<!-- tabs:start -->

### **Python3**

```python

```

### **Java**

```java

```

### **TypeScript**

```ts

```

### **...**

```

```

<!-- tabs:end -->
77 changes: 77 additions & 0 deletions solution/2200-2299/2236.Root Equals Sum of Children/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# [2236. 判断根结点是否等于子结点之和](https://leetcode-cn.com/problems/root-equals-sum-of-children)

[English Version](/solution/2200-2299/2236.Root%20Equals%20Sum%20of%20Children/README_EN.md)

## 题目描述

<!-- 这里写题目描述 -->

<p>给你一个 <strong>二叉树 </strong>的根结点&nbsp;<code>root</code>,该二叉树由恰好&nbsp;<code>3</code>&nbsp;个结点组成:根结点、左子结点和右子结点。</p>

<p>如果根结点值等于两个子结点值之和,返回&nbsp;<code>true</code>&nbsp;,否则返回<em>&nbsp;</em><code>false</code> 。</p>

<p>&nbsp;</p>

<p><strong>示例 1:</strong></p>
<img alt="" src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/2200-2299/2236.Root%20Equals%20Sum%20of%20Children/images/graph3drawio.png" style="width: 281px; height: 199px;" />
<pre>
<strong>输入:</strong>root = [10,4,6]
<strong>输出:</strong>true
<strong>解释:</strong>根结点、左子结点和右子结点的值分别是 10 、4 和 6 。
由于 10 等于 4 + 6 ,因此返回 true 。
</pre>

<p><strong>示例 2:</strong></p>
<img alt="" src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/2200-2299/2236.Root%20Equals%20Sum%20of%20Children/images/graph3drawio-1.png" style="width: 281px; height: 199px;" />
<pre>
<strong>输入:</strong>root = [5,3,1]
<strong>输出:</strong>false
<strong>解释:</strong>根结点、左子结点和右子结点的值分别是 5 、3 和 1 。
由于 5 不等于 3 + 1 ,因此返回 false 。
</pre>

<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<ul>
<li>树只包含根结点、左子结点和右子结点</li>
<li><code>-100 &lt;= Node.val &lt;= 100</code></li>
</ul>


## 解法

<!-- 这里可写通用的实现逻辑 -->

<!-- tabs:start -->

### **Python3**

<!-- 这里可写当前语言的特殊实现逻辑 -->

```python

```

### **Java**

<!-- 这里可写当前语言的特殊实现逻辑 -->

```java

```

### **TypeScript**

```ts

```

### **...**

```

```

<!-- tabs:end -->
67 changes: 67 additions & 0 deletions solution/2200-2299/2236.Root Equals Sum of Children/README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# [2236. Root Equals Sum of Children](https://leetcode.com/problems/root-equals-sum-of-children)

[中文文档](/solution/2200-2299/2236.Root%20Equals%20Sum%20of%20Children/README.md)

## Description

<p>You are given the <code>root</code> of a <strong>binary tree</strong> that consists of exactly <code>3</code> nodes: the root, its left child, and its right child.</p>

<p>Return <code>true</code> <em>if the value of the root is equal to the <strong>sum</strong> of the values of its two children, or </em><code>false</code><em> otherwise</em>.</p>

<p>&nbsp;</p>
<p><strong>Example 1:</strong></p>
<img alt="" src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/2200-2299/2236.Root%20Equals%20Sum%20of%20Children/images/graph3drawio.png" style="width: 281px; height: 199px;" />
<pre>
<strong>Input:</strong> root = [10,4,6]
<strong>Output:</strong> true
<strong>Explanation:</strong> The values of the root, its left child, and its right child are 10, 4, and 6, respectively.
10 is equal to 4 + 6, so we return true.
</pre>

<p><strong>Example 2:</strong></p>
<img alt="" src="https://cdn.jsdelivr.net/gh/doocs/leetcode@main/solution/2200-2299/2236.Root%20Equals%20Sum%20of%20Children/images/graph3drawio-1.png" style="width: 281px; height: 199px;" />
<pre>
<strong>Input:</strong> root = [5,3,1]
<strong>Output:</strong> false
<strong>Explanation:</strong> The values of the root, its left child, and its right child are 5, 3, and 1, respectively.
5 is not equal to 3 + 1, so we return false.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
<li>The tree consists only of the root, its left child, and its right child.</li>
<li><code>-100 &lt;= Node.val &lt;= 100</code></li>
</ul>


## Solutions

<!-- tabs:start -->

### **Python3**

```python

```

### **Java**

```java

```

### **TypeScript**

```ts

```

### **...**

```

```

<!-- tabs:end -->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading