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
2 changes: 1 addition & 1 deletion Index/二分.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
| [1707. 与数组中元素的最大异或值](https://leetcode-cn.com/problems/maximum-xor-with-an-element-from-array/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/maximum-xor-with-an-element-from-array/solution/gong-shui-san-xie-jie-zhe-ge-wen-ti-lai-lypqr/) | 困难 | 🤩🤩🤩 |
| [1713. 得到子序列的最少操作次数](https://leetcode-cn.com/problems/minimum-operations-to-make-a-subsequence/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/minimum-operations-to-make-a-subsequence/solution/gong-shui-san-xie-noxiang-xin-ke-xue-xi-oj7yu/) | 困难 | 🤩🤩🤩 |
| [1751. 最多可以参加的会议数目 II](https://leetcode-cn.com/problems/maximum-number-of-events-that-can-be-attended-ii/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/maximum-number-of-events-that-can-be-attended-ii/solution/po-su-dp-er-fen-dp-jie-fa-by-ac_oier-88du/) | 困难 | 🤩🤩🤩 |
| [1760. 袋子里最少数目的球](https://leetcode.cn/problems/minimum-limit-of-balls-in-a-bag/) | [LeetCode 题解链接](https://acoier.com/2022/12/23/1760.%20%E8%A2%8B%E5%AD%90%E9%87%8C%E6%9C%80%E5%B0%91%E6%95%B0%E7%9B%AE%E7%9A%84%E7%90%83%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩🤩 |
| [1760. 袋子里最少数目的球](https://leetcode.cn/problems/minimum-limit-of-balls-in-a-bag/) | [LeetCode 题解链接](https://acoier.com/2022/12/26/1760.%20%E8%A2%8B%E5%AD%90%E9%87%8C%E6%9C%80%E5%B0%91%E6%95%B0%E7%9B%AE%E7%9A%84%E7%90%83%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩🤩 |
| [1802. 有界数组中指定下标处的最大值](https://leetcode.cn/problems/maximum-value-at-a-given-index-in-a-bounded-array/) | [LeetCode 题解链接](https://acoier.com/2023/01/06/1802.%20%E6%9C%89%E7%95%8C%E6%95%B0%E7%BB%84%E4%B8%AD%E6%8C%87%E5%AE%9A%E4%B8%8B%E6%A0%87%E5%A4%84%E7%9A%84%E6%9C%80%E5%A4%A7%E5%80%BC%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/) | 中等 | 🤩🤩🤩🤩 |
| [1818. 绝对差值和](https://leetcode-cn.com/problems/minimum-absolute-sum-difference/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/minimum-absolute-sum-difference/solution/gong-shui-san-xie-tong-guo-er-fen-zhao-z-vrmq/) | 中等 | 🤩🤩🤩🤩🤩 |
| [1838. 最高频元素的频数](https://leetcode-cn.com/problems/frequency-of-the-most-frequent-element/) | [LeetCode 题解链接](https://leetcode-cn.com/problems/frequency-of-the-most-frequent-element/solution/gong-shui-san-xie-cong-mei-ju-dao-pai-xu-kxnk/) | 中等 | 🤩🤩🤩 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@ Tag : 「前缀和」



给你一个下标从 0 开始的正整数数组 candiesCount ,其中 candiesCount[i] 表示你拥有的第 i 类糖果的数目。同时给你一个二维数组 queries ,其中 queries[i] = [favoriteTypei, favoriteDayi, dailyCapi] 。
给你一个下标从 `0` 开始的正整数数组 `candiesCount`,其中 `candiesCount[i]` 表示你拥有的第 `i` 类糖果的数目。

同时给你一个二维数组 `queries` ,其中 $queries[i] = [favoriteType_{i}, favoriteDay_{i}, dailyCap_{i}]$ 。

你按照如下规则进行一场游戏:

* 你从第 0 天开始吃糖果。
* 你在吃完 所有 第 i - 1 类糖果之前,不能 吃任何一颗第 i 类糖果。
* 你从第 `0` 天开始吃糖果。
* 你在吃完 所有 第 `i - 1` 类糖果之前,不能 吃任何一颗第 `i` 类糖果。
* 在吃完所有糖果之前,你必须每天 至少 吃 一颗 糖果。

请你构建一个布尔型数组 answer ,满足 answer.length == queries.length 。answer[i] 为 true 的条件是:在每天吃 不超过 dailyCapi 颗糖果的前提下,你可以在第 favoriteDayi 天吃到第 favoriteTypei 类糖果;否则 answer[i] 为 false 。注意,只要满足上面 3 条规则中的第二条规则,你就可以在同一天吃不同类型的糖果。
请你构建一个布尔型数组 `answer`,满足 `answer.length == queries.length`。`answer[i]` 为 `true` 的条件是:在每天吃 不超过 $dailyCap_i$ 颗糖果的前提下,你可以在第 $favoriteDay_i$ 天吃到第 $favoriteType_i$ 类糖果;否则 `answer[i]` 为 `false`。注意,只要满足上面 `3` 条规则中的第二条规则,你就可以在同一天吃不同类型的糖果。

请你返回得到的数组 `answer` 。

请你返回得到的数组 answer 。



示例 1:
```
输入:candiesCount = [7,4,5,3,8], queries = [[0,2,2],[4,2,4],[2,13,1000000000]]

输出:[true,false,true]

提示:
1- 在第 0 天吃 2 颗糖果(类型 0),第 1 天吃 2 颗糖果(类型 0),第 2 天你可以吃到类型 0 的糖果。
2- 每天你最多吃 4 颗糖果。即使第 0 天吃 4 颗糖果(类型 0),第 1 天吃 4 颗糖果(类型 0 和类型 1),你也没办法在第 2 天吃到类型 4 的糖果。换言之,你没法在每天吃 4 颗糖果的限制下在第 2 天吃到第 4 类糖果。
Expand All @@ -32,17 +36,18 @@ Tag : 「前缀和」
示例 2:
```
输入:candiesCount = [5,2,6,4,1], queries = [[3,1,2],[4,10,3],[3,10,100],[4,100,30],[1,3,1]]

输出:[false,true,true,false,false]
```

提示:
* 1 <= candiesCount.length <= $10^5$
* 1 <= candiesCount[i] <= $10^5$
* 1 <= queries.length <= $10^5$
* queries[i].length == 3
* 0 <= favoriteTypei < candiesCount.length
* 0 <= favoriteDayi <= $10^9$
* 1 <= dailyCapi <= $10^9$
* $1 <= candiesCount.length <= 10^5$
* $1 <= candiesCount[i] <= 10^5$
* $1 <= queries.length <= 10^5$
* $queries[i].length == 3$
* $0 <= favoriteType_{i} < candiesCount.length$
* $0 <= favoriteDay_{i} <= 10^9$
* $1 <= dailyCap_{i} <= 10^9$

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### 题目描述

这是 LeetCode 上的 **[1760. 袋子里最少数目的球](https://acoier.com/2022/12/23/1760.%20%E8%A2%8B%E5%AD%90%E9%87%8C%E6%9C%80%E5%B0%91%E6%95%B0%E7%9B%AE%E7%9A%84%E7%90%83%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/)** ,难度为 **中等**。
这是 LeetCode 上的 **[1760. 袋子里最少数目的球](https://acoier.com/2022/12/26/1760.%20%E8%A2%8B%E5%AD%90%E9%87%8C%E6%9C%80%E5%B0%91%E6%95%B0%E7%9B%AE%E7%9A%84%E7%90%83%EF%BC%88%E4%B8%AD%E7%AD%89%EF%BC%89/)** ,难度为 **中等**。

Tag : 「二分」

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

Tag : 「最长公共子序列」、「序列 DP」

给定两个单词 word1 和 word2,找到使得 word1 和 word2 相同所需的最小步数,每步可以删除任意一个字符串中的一个字符。


给定两个单词 `word1` 和 `word2`,找到使得 `word1` 和 `word2` 相同所需的最小步数,每步可以删除任意一个字符串中的一个字符。

示例:

```
输入: "sea", "eat"

Expand All @@ -16,7 +19,7 @@ Tag : 「最长公共子序列」、「序列 DP」
```

提示:
* 给定单词的长度不超过500
* 给定单词的长度不超过 $500$
* 给定单词中的字符只含有小写字母。

---
Expand Down Expand Up @@ -67,8 +70,8 @@ class Solution {
}
}
```
* 时间复杂度:$O(n * m)$
* 空间复杂度:$O(n * m)$
* 时间复杂度:$O(n \times m)$
* 空间复杂度:$O(n \times m)$

---

Expand Down Expand Up @@ -104,8 +107,8 @@ class Solution {
}
}
```
* 时间复杂度:$O(n * m)$
* 空间复杂度:$O(n * m)$
* 时间复杂度:$O(n \times m)$
* 空间复杂度:$O(n \times m)$

---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### 题目描述

这是 LeetCode 上的 **[84. 柱状图中最大的矩形](https://leetcode.cn/problems/largest-rectangle-in-histogram/solution/by-ac_oier-i470/)** ,难度为 **中等**。
这是 LeetCode 上的 **[84. 柱状图中最大的矩形](https://leetcode.cn/problems/largest-rectangle-in-histogram/solution/by-ac_oier-i470/)** ,难度为 **困难**。

Tag : 「单调栈」

Expand All @@ -12,6 +12,7 @@ Tag : 「单调栈」

示例 1:
![](https://assets.leetcode.com/uploads/2021/01/04/histogram.jpg)

```
输入:heights = [2,1,5,6,2,3]

Expand All @@ -21,6 +22,7 @@ Tag : 「单调栈」
```
示例 2:
![](https://assets.leetcode.com/uploads/2021/01/04/histogram-1.jpg)

```
输入: heights = [2,4]

Expand Down