Skip to content

Commit e3e1b32

Browse files
committed
Deploying to main from @ 8a2028e 🚀
1 parent 35709cd commit e3e1b32

21 files changed

+615
-19
lines changed

Diff for: book/dynamic_programming.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
| 343 | 整数拆分 | [[]](/problem/0343.md) | [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) | 🟠 | [🀄️](https://leetcode.cn/problems/integer-break) [🔗](https://leetcode.com/problems/integer-break) |
289289
| 96 | 不同的二叉搜索树 | [[]](/problem/0096.md) | [``](/tag/tree.md) [`二叉搜索树`](/tag/binary-search-tree.md) [`数学`](/tag/math.md) `2+` | 🟠 | [🀄️](https://leetcode.cn/problems/unique-binary-search-trees) [🔗](https://leetcode.com/problems/unique-binary-search-trees) |
290290
| 1259 | 不相交的握手 🔒 | | [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) | 🔴 | [🀄️](https://leetcode.cn/problems/handshakes-that-dont-cross) [🔗](https://leetcode.com/problems/handshakes-that-dont-cross) |
291-
| 790 | 多米诺和托米诺平铺 | | [`动态规划`](/tag/dynamic-programming.md) | 🟠 | [🀄️](https://leetcode.cn/problems/domino-and-tromino-tiling) [🔗](https://leetcode.com/problems/domino-and-tromino-tiling) |
291+
| 790 | 多米诺和托米诺平铺 | [[]](/problem/0790.md) | [`动态规划`](/tag/dynamic-programming.md) | 🟠 | [🀄️](https://leetcode.cn/problems/domino-and-tromino-tiling) [🔗](https://leetcode.com/problems/domino-and-tromino-tiling) |
292292
| 70 | 爬楼梯 | [[]](/problem/0070.md) | [`记忆化搜索`](/tag/memoization.md) [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md) | 🟢 | [🀄️](https://leetcode.cn/problems/climbing-stairs) [🔗](https://leetcode.com/problems/climbing-stairs) |
293293
| 746 | 使用最小花费爬楼梯 | [[]](/problem/0746.md) | [`数组`](/tag/array.md) [`动态规划`](/tag/dynamic-programming.md) | 🟢 | [🀄️](https://leetcode.cn/problems/min-cost-climbing-stairs) [🔗](https://leetcode.com/problems/min-cost-climbing-stairs) |
294294
| 509 | 斐波那契数 | [[]](/problem/0509.md) | [`递归`](/tag/recursion.md) [`记忆化搜索`](/tag/memoization.md) [`数学`](/tag/math.md) `1+` | 🟢 | [🀄️](https://leetcode.cn/problems/fibonacci-number) [🔗](https://leetcode.com/problems/fibonacci-number) |

Diff for: plan/company_list.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ headerDepth: 0
193193
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 | 频次 |
194194
| :------: | :------ | :------: | :------ | :------: | :------: | :------: |
195195
| 103 | 二叉树的锯齿形层序遍历 | [[]](/problem/0103.md) | [``](/tag/tree.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`二叉树`](/tag/binary-tree.md) | 🟠 | [🀄️](https://leetcode.cn/problems/binary-tree-zigzag-level-order-traversal) [🔗](https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal) | 22 |
196-
| 1448 | 统计二叉树中好节点的数目 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-good-nodes-in-binary-tree) [🔗](https://leetcode.com/problems/count-good-nodes-in-binary-tree) | 18 |
196+
| 1448 | 统计二叉树中好节点的数目 | [[]](/problem/1448.md) | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-good-nodes-in-binary-tree) [🔗](https://leetcode.com/problems/count-good-nodes-in-binary-tree) | 18 |
197197
| 46 | 全排列 | [[]](/problem/0046.md) | [`数组`](/tag/array.md) [`回溯`](/tag/backtracking.md) | 🟠 | [🀄️](https://leetcode.cn/problems/permutations) [🔗](https://leetcode.com/problems/permutations) | 16 |
198198
| 297 | 二叉树的序列化与反序列化 | [[]](/problem/0297.md) | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `3+` | 🔴 | [🀄️](https://leetcode.cn/problems/serialize-and-deserialize-binary-tree) [🔗](https://leetcode.com/problems/serialize-and-deserialize-binary-tree) | 14 |
199199
| 4 | 寻找两个正序数组的中位数 | [[]](/problem/0004.md) | [`数组`](/tag/array.md) [`二分查找`](/tag/binary-search.md) [`分治`](/tag/divide-and-conquer.md) | 🔴 | [🀄️](https://leetcode.cn/problems/median-of-two-sorted-arrays) [🔗](https://leetcode.com/problems/median-of-two-sorted-arrays) | 14 |

Diff for: plan/contest_list.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ headerDepth: 0
18481848
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
18491849
| :------: | :------ | :------: | :------ | :------: | :------: |
18501850
| 2460 | 对数组执行操作 | | [`数组`](/tag/array.md) [`双指针`](/tag/two-pointers.md) [`模拟`](/tag/simulation.md) | 🟢 | [🀄️](https://leetcode.cn/problems/apply-operations-to-an-array) [🔗](https://leetcode.com/problems/apply-operations-to-an-array) |
1851-
| 2461 | 长度为 K 子数组中的最大和 | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`滑动窗口`](/tag/sliding-window.md) | 🟠 | [🀄️](https://leetcode.cn/problems/maximum-sum-of-distinct-subarrays-with-length-k) [🔗](https://leetcode.com/problems/maximum-sum-of-distinct-subarrays-with-length-k) |
1851+
| 2461 | 长度为 K 子数组中的最大和 | [[✓]](/problem/2461.md) | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`滑动窗口`](/tag/sliding-window.md) | 🟠 | [🀄️](https://leetcode.cn/problems/maximum-sum-of-distinct-subarrays-with-length-k) [🔗](https://leetcode.com/problems/maximum-sum-of-distinct-subarrays-with-length-k) |
18521852
| 2462 | 雇佣 K 位工人的总代价 | | [`数组`](/tag/array.md) [`双指针`](/tag/two-pointers.md) [`模拟`](/tag/simulation.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/total-cost-to-hire-k-workers) [🔗](https://leetcode.com/problems/total-cost-to-hire-k-workers) |
18531853
| 2463 | 最小移动总距离 | [[✓]](/problem/2463.md) | [`数组`](/tag/array.md) [`动态规划`](/tag/dynamic-programming.md) [`排序`](/tag/sorting.md) | 🔴 | [🀄️](https://leetcode.cn/problems/minimum-total-distance-traveled) [🔗](https://leetcode.com/problems/minimum-total-distance-traveled) |
18541854

@@ -4177,7 +4177,7 @@ headerDepth: 0
41774177
| :------: | :------ | :------: | :------ | :------: | :------: |
41784178
| 1446 | 连续字符 | | [`字符串`](/tag/string.md) | 🟢 | [🀄️](https://leetcode.cn/problems/consecutive-characters) [🔗](https://leetcode.com/problems/consecutive-characters) |
41794179
| 1447 | 最简分数 | | [`数学`](/tag/math.md) [`字符串`](/tag/string.md) [`数论`](/tag/number-theory.md) | 🟠 | [🀄️](https://leetcode.cn/problems/simplified-fractions) [🔗](https://leetcode.com/problems/simplified-fractions) |
4180-
| 1448 | 统计二叉树中好节点的数目 | | [`树`](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-good-nodes-in-binary-tree) [🔗](https://leetcode.com/problems/count-good-nodes-in-binary-tree) |
4180+
| 1448 | 统计二叉树中好节点的数目 | [[✓]](/problem/1448.md) | [`树`](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-good-nodes-in-binary-tree) [🔗](https://leetcode.com/problems/count-good-nodes-in-binary-tree) |
41814181
| 1449 | 数位成本和为目标值的最大数字 | | [`数组`](/tag/array.md) [`动态规划`](/tag/dynamic-programming.md) | 🔴 | [🀄️](https://leetcode.cn/problems/form-largest-integer-with-digits-that-add-up-to-target) [🔗](https://leetcode.com/problems/form-largest-integer-with-digits-that-add-up-to-target) |
41824182

41834183

@@ -4488,7 +4488,7 @@ headerDepth: 0
44884488
| 题号 | 标题 | 题解 | 标签 | 难度 | 力扣 |
44894489
| :------: | :------ | :------: | :------ | :------: | :------: |
44904490
| 1317 | 将整数转换为两个无零整数的和 | | [`数学`](/tag/math.md) | 🟢 | [🀄️](https://leetcode.cn/problems/convert-integer-to-the-sum-of-two-no-zero-integers) [🔗](https://leetcode.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers) |
4491-
| 1318 | 或运算的最小翻转次数 | | [`位运算`](/tag/bit-manipulation.md) | 🟠 | [🀄️](https://leetcode.cn/problems/minimum-flips-to-make-a-or-b-equal-to-c) [🔗](https://leetcode.com/problems/minimum-flips-to-make-a-or-b-equal-to-c) |
4491+
| 1318 | 或运算的最小翻转次数 | [[✓]](/problem/1318.md) | [`位运算`](/tag/bit-manipulation.md) | 🟠 | [🀄️](https://leetcode.cn/problems/minimum-flips-to-make-a-or-b-equal-to-c) [🔗](https://leetcode.com/problems/minimum-flips-to-make-a-or-b-equal-to-c) |
44924492
| 1319 | 连通网络的操作次数 | | [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`并查集`](/tag/union-find.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/number-of-operations-to-make-network-connected) [🔗](https://leetcode.com/problems/number-of-operations-to-make-network-connected) |
44934493
| 1320 | 二指输入的的最小距离 | | [`字符串`](/tag/string.md) [`动态规划`](/tag/dynamic-programming.md) | 🔴 | [🀄️](https://leetcode.cn/problems/minimum-distance-to-type-a-word-using-two-fingers) [🔗](https://leetcode.com/problems/minimum-distance-to-type-a-word-using-two-fingers) |
44944494

Diff for: plan/rabbit_list.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ headerDepth: 0
9999
| 543 | 二叉树的直径 | [[]](/problem/0543.md) | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`二叉树`](/tag/binary-tree.md) | 🟢 | [🀄️](https://leetcode.cn/problems/diameter-of-binary-tree) [🔗](https://leetcode.com/problems/diameter-of-binary-tree) | 18 |
100100
| 92 | 反转链表 II | [[]](/problem/0092.md) | [`链表`](/tag/linked-list.md) | 🟠 | [🀄️](https://leetcode.cn/problems/reverse-linked-list-ii) [🔗](https://leetcode.com/problems/reverse-linked-list-ii) | 18 |
101101
| 74 | 搜索二维矩阵 | [[]](/problem/0074.md) | [`数组`](/tag/array.md) [`二分查找`](/tag/binary-search.md) [`矩阵`](/tag/matrix.md) | 🟠 | [🀄️](https://leetcode.cn/problems/search-a-2d-matrix) [🔗](https://leetcode.com/problems/search-a-2d-matrix) | 18 |
102-
| 1448 | 统计二叉树中好节点的数目 | | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-good-nodes-in-binary-tree) [🔗](https://leetcode.com/problems/count-good-nodes-in-binary-tree) | 18 |
102+
| 1448 | 统计二叉树中好节点的数目 | [[]](/problem/1448.md) | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/count-good-nodes-in-binary-tree) [🔗](https://leetcode.com/problems/count-good-nodes-in-binary-tree) | 18 |
103103
| 100 | 相同的树 | [[]](/problem/0100.md) | [``](/tag/tree.md) [`深度优先搜索`](/tag/depth-first-search.md) [`广度优先搜索`](/tag/breadth-first-search.md) `1+` | 🟢 | [🀄️](https://leetcode.cn/problems/same-tree) [🔗](https://leetcode.com/problems/same-tree) | 18 |
104104
| 1268 | 搜索推荐系统 | | [`字典树`](/tag/trie.md) [`数组`](/tag/array.md) [`字符串`](/tag/string.md) `3+` | 🟠 | [🀄️](https://leetcode.cn/problems/search-suggestions-system) [🔗](https://leetcode.com/problems/search-suggestions-system) | 18 |
105105
| 953 | 验证外星语词典 | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`字符串`](/tag/string.md) | 🟢 | [🀄️](https://leetcode.cn/problems/verifying-an-alien-dictionary) [🔗](https://leetcode.com/problems/verifying-an-alien-dictionary) | 18 |

Diff for: plan/top_300_list.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ headerDepth: 0
290290
| 268 | 丢失的数字 | [[]](/problem/0268.md) | [`位运算`](/tag/bit-manipulation.md) [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) `3+` | 🟢 | [🀄️](https://leetcode.cn/problems/missing-number) [🔗](https://leetcode.com/problems/missing-number) |
291291
| 78 | 子集 | [[]](/problem/0078.md) | [`位运算`](/tag/bit-manipulation.md) [`数组`](/tag/array.md) [`回溯`](/tag/backtracking.md) | 🟠 | [🀄️](https://leetcode.cn/problems/subsets) [🔗](https://leetcode.com/problems/subsets) |
292292
| 338 | 比特位计数 | [[]](/problem/0338.md) | [`位运算`](/tag/bit-manipulation.md) [`动态规划`](/tag/dynamic-programming.md) | 🟢 | [🀄️](https://leetcode.cn/problems/counting-bits) [🔗](https://leetcode.com/problems/counting-bits) |
293-
| 1318 | 或运算的最小翻转次数 | | [`位运算`](/tag/bit-manipulation.md) | 🟠 | [🀄️](https://leetcode.cn/problems/minimum-flips-to-make-a-or-b-equal-to-c) [🔗](https://leetcode.com/problems/minimum-flips-to-make-a-or-b-equal-to-c) |
293+
| 1318 | 或运算的最小翻转次数 | [[]](/problem/1318.md) | [`位运算`](/tag/bit-manipulation.md) | 🟠 | [🀄️](https://leetcode.cn/problems/minimum-flips-to-make-a-or-b-equal-to-c) [🔗](https://leetcode.com/problems/minimum-flips-to-make-a-or-b-equal-to-c) |
294294
| 89 | 格雷编码 | | [`位运算`](/tag/bit-manipulation.md) [`数学`](/tag/math.md) [`回溯`](/tag/backtracking.md) | 🟠 | [🀄️](https://leetcode.cn/problems/gray-code) [🔗](https://leetcode.com/problems/gray-code) |
295295
| 260 | 只出现一次的数字 III | | [`位运算`](/tag/bit-manipulation.md) [`数组`](/tag/array.md) | 🟠 | [🀄️](https://leetcode.cn/problems/single-number-iii) [🔗](https://leetcode.com/problems/single-number-iii) |
296296
| 371 | 两整数之和 | | [`位运算`](/tag/bit-manipulation.md) [`数学`](/tag/math.md) | 🟠 | [🀄️](https://leetcode.cn/problems/sum-of-two-integers) [🔗](https://leetcode.com/problems/sum-of-two-integers) |

Diff for: problem/0790.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: 790. 多米诺和托米诺平铺
3+
description: LeetCode,790. 多米诺和托米诺平铺,多米诺和托米诺平铺,Domino and Tromino Tiling,解题思路,动态规划
4+
keywords:
5+
- LeetCode
6+
- 790. 多米诺和托米诺平铺
7+
- 多米诺和托米诺平铺
8+
- Domino and Tromino Tiling
9+
- 解题思路
10+
- 动态规划
11+
---
12+
13+
# 790. 多米诺和托米诺平铺
14+
15+
🟠 <font color=#ffb800>Medium</font>&emsp; 🔖&ensp; [`动态规划`](/tag/dynamic-programming.md)&emsp; 🔗&ensp;[`力扣`](https://leetcode.cn/problems/domino-and-tromino-tiling) [`LeetCode`](https://leetcode.com/problems/domino-and-tromino-tiling)
16+
17+
## 题目
18+
19+
You have two types of tiles: a `2 x 1` domino shape and a tromino shape. You
20+
may rotate these shapes.
21+
22+
![](https://assets.leetcode.com/uploads/2021/07/15/lc-domino.jpg)
23+
24+
Given an integer n, return _the number of ways to tile an_ `2 x n` _board_.
25+
Since the answer may be very large, return it **modulo** `109 + 7`.
26+
27+
In a tiling, every square must be covered by a tile. Two tilings are different
28+
if and only if there are two 4-directionally adjacent cells on the board such
29+
that exactly one of the tilings has both squares occupied by a tile.
30+
31+
**Example 1:**
32+
33+
![](https://assets.leetcode.com/uploads/2021/07/15/lc-domino1.jpg)
34+
35+
> Input: n = 3
36+
>
37+
> Output: 5
38+
>
39+
> Explanation: The five different ways are show above.
40+
41+
**Example 2:**
42+
43+
> Input: n = 1
44+
>
45+
> Output: 1
46+
47+
**Constraints:**
48+
49+
- `1 <= n <= 1000`
50+
51+
## 题目大意
52+
53+
有两种形状的瓷砖:一种是 `2 x 1` 的多米诺形,另一种是形如 "L" 的托米诺形。两种形状都可以旋转。
54+
55+
![](https://assets.leetcode.com/uploads/2021/07/15/lc-domino.jpg)
56+
57+
给定整数 n ,返回可以平铺 `2 x n` 的面板的方法的数量。**返回对** `109 + 7` **取模** 的值。
58+
59+
平铺指的是每个正方形都必须有瓷砖覆盖。两个平铺不同,当且仅当面板上有四个方向上的相邻单元中的两个,使得恰好有一个平铺有一个瓷砖占据两个正方形。
60+
61+
**示例 1:**
62+
63+
![](https://assets.leetcode.com/uploads/2021/07/15/lc-domino1.jpg)
64+
65+
> **输入:** n = 3
66+
>
67+
> **输出:** 5
68+
>
69+
> **解释:** 五种不同的方法如上所示。
70+
71+
**示例 2:**
72+
73+
> **输入:** n = 1
74+
>
75+
> **输出:** 1
76+
77+
**提示:**
78+
79+
- `1 <= n <= 1000`
80+
81+
## 解题思路
82+
83+
#### 复杂度分析
84+
85+
- **时间复杂度**`O()`
86+
- **空间复杂度**`O()`
87+
88+
## 代码
89+
90+
```javascript
91+
92+
```

Diff for: problem/1004.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,5 @@ var longestOnes = function (nums, k) {
140140
| 2024 | 考试的最大困扰度 | | [`字符串`](/tag/string.md) [`二分查找`](/tag/binary-search.md) [`前缀和`](/tag/prefix-sum.md) `1+` | 🟠 | [🀄️](https://leetcode.cn/problems/maximize-the-confusion-of-an-exam) [🔗](https://leetcode.com/problems/maximize-the-confusion-of-an-exam) |
141141
| 2379 | 得到 K 个黑块的最少涂色次数 | | [`字符串`](/tag/string.md) [`滑动窗口`](/tag/sliding-window.md) | 🟢 | [🀄️](https://leetcode.cn/problems/minimum-recolors-to-get-k-consecutive-black-blocks) [🔗](https://leetcode.com/problems/minimum-recolors-to-get-k-consecutive-black-blocks) |
142142
| 2401 | 最长优雅子数组 | | [`位运算`](/tag/bit-manipulation.md) [`数组`](/tag/array.md) [`滑动窗口`](/tag/sliding-window.md) | 🟠 | [🀄️](https://leetcode.cn/problems/longest-nice-subarray) [🔗](https://leetcode.com/problems/longest-nice-subarray) |
143-
| 2461 | 长度为 K 子数组中的最大和 | | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`滑动窗口`](/tag/sliding-window.md) | 🟠 | [🀄️](https://leetcode.cn/problems/maximum-sum-of-distinct-subarrays-with-length-k) [🔗](https://leetcode.com/problems/maximum-sum-of-distinct-subarrays-with-length-k) |
143+
| 2461 | 长度为 K 子数组中的最大和 | [[]](/problem/2461.md) | [`数组`](/tag/array.md) [`哈希表`](/tag/hash-table.md) [`滑动窗口`](/tag/sliding-window.md) | 🟠 | [🀄️](https://leetcode.cn/problems/maximum-sum-of-distinct-subarrays-with-length-k) [🔗](https://leetcode.com/problems/maximum-sum-of-distinct-subarrays-with-length-k) |
144144
| 2511 | 最多可以摧毁的敌人城堡数目 | | [`数组`](/tag/array.md) [`双指针`](/tag/two-pointers.md) | 🟢 | [🀄️](https://leetcode.cn/problems/maximum-enemy-forts-that-can-be-captured) [🔗](https://leetcode.com/problems/maximum-enemy-forts-that-can-be-captured) |

0 commit comments

Comments
 (0)