1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-04 23:11:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-10-07 21:03:28 +08:00
parent b43009ddf3
commit ee13c73307
59 changed files with 18268 additions and 12348 deletions

View File

@@ -0,0 +1,30 @@
力扣嘉年华的花店中从左至右摆放了一排鲜花,记录于整型一维矩阵 `flowers` 中每个数字表示该位置所种鲜花的品种编号。你可以选择一段区间的鲜花做成插花,且不能丢弃。
在你选择的插花中,如果每一品种的鲜花数量都不超过 `cnt` 朵,那么我们认为这束插花是 「美观的」。
> - 例如:`[5,5,5,6,6]` 中品种为 `5` 的花有 `3` 朵, 品种为 `6` 的花有 `2` 朵,**每一品种** 的数量均不超过 `3`
请返回在这一排鲜花中,共有多少种可选择的区间,使得插花是「美观的」。
**注意:**
- 答案需要以 `1e9 + 7 (1000000007)` 为底取模,如:计算初始结果为:`1000000008`,请返回 `1`
**示例 1**
>输入:`flowers = [1,2,3,2], cnt = 1`
>
>输出:`8`
>
>解释:相同的鲜花不超过 `1` 朵,共有 `8` 种花束是美观的;