当前位置: 首页 > news >正文

建自己的网站用多少钱推广方案有哪些

建自己的网站用多少钱,推广方案有哪些,网易工作做网站工资奖金高吗,能否提供代码 网站建设【LetMeFly】2251.花期内花的数目:排序 二分 力扣题目链接:https://leetcode.cn/problems/number-of-flowers-in-full-bloom/ 给你一个下标从 0 开始的二维整数数组 flowers ,其中 flowers[i] [starti, endi] 表示第 i 朵花的 花期 从 st…

【LetMeFly】2251.花期内花的数目:排序 + 二分

力扣题目链接:https://leetcode.cn/problems/number-of-flowers-in-full-bloom/

给你一个下标从 0 开始的二维整数数组 flowers ,其中 flowers[i] = [starti, endi] 表示第 i 朵花的 花期 从 starti 到 endi (都 包含)。同时给你一个下标从 0 开始大小为 n 的整数数组 persons ,persons[i] 是第 i 个人来看花的时间。

请你返回一个大小为 n 的整数数组 answer ,其中 answer[i]是第 i 个人到达时在花期内花的 数目 。

 

示例 1:

输入:flowers = [[1,6],[3,7],[9,12],[4,13]], persons = [2,3,7,11]
输出:[1,2,2,2]
解释:上图展示了每朵花的花期时间,和每个人的到达时间。
对每个人,我们返回他们到达时在花期内花的数目。

示例 2:

输入:flowers = [[1,10],[3,3]], persons = [3,3,2]
输出:[2,2,1]
解释:上图展示了每朵花的花期时间,和每个人的到达时间。
对每个人,我们返回他们到达时在花期内花的数目。

 

提示:

  • 1 <= flowers.length <= 5 * 104
  • flowers[i].length == 2
  • 1 <= starti <= endi <= 109
  • 1 <= persons.length <= 5 * 104
  • 1 <= persons[i] <= 109

方法一:排序 + 二分

将所有的开花时间放入一个数组并从小到大排序;将所有的闭花时间也放入一个数组并从小到大排序。

对于某个时刻(某一天),当前盛开的花朵的数量为: 开花时间小于等于当前时间的花数 − 闭花小于等于当前时间前一天的花数 开花时间小于等于当前时间的花数 - 闭花小于等于当前时间前一天的花数 开花时间小于等于当前时间的花数闭花小于等于当前时间前一天的花数

如何快速得到非降序数组 a a a ≤ k \leq k k的元素的个数?二分即可。(C++的upper_bound / Python的bisect_right)

  • 时间复杂度 O ( ( n + m ) log ⁡ n ) O((n + m)\log n) O((n+m)logn),其中 n = l e n ( f l o w e r s ) n = len(flowers) n=len(flowers) m = l e n ( p e o p l e ) m = len(people) m=len(people)
  • 空间复杂度 O ( n ) O(n) O(n),力扣返回值不计入算法空间复杂度

AC代码

C++
class Solution {
public:vector<int> fullBloomFlowers(vector<vector<int>>& flowers, vector<int>& people) {vector<int> start(flowers.size()), end(flowers.size()), ans(people.size());for (int i = 0; i < flowers.size(); i++) {start[i] = flowers[i][0];end[i] = flowers[i][1];}sort(start.begin(), start.end());sort(end.begin(), end.end());for (int i = 0; i < people.size(); i++) {// 到这一天为止的开花总数 - 到这一天的前一天为止的闭花总数int hanagasaku = upper_bound(start.begin(), start.end(), people[i]) - start.begin();  // 花が咲く(はながさく)int hanagatiru = upper_bound(end.begin(), end.end(), people[i] - 1) - end.begin();//  花が散る(はながちる)ans[i] = hanagasaku - hanagatiru;}return ans;}
};
Python

真简!

# from typing import List
# from bisect import bisect_rightclass Solution:def fullBloomFlowers(self, flowers: List[List[int]], people: List[int]) -> List[int]:start = sorted([f[0] for f in flowers])end = sorted([f[1] for f in flowers])return [bisect_right(start, p) - bisect_right(end, p - 1) for p in people]

同步发文于CSDN,原创不易,转载经作者同意后请附上原文链接哦~
Tisfy:https://letmefly.blog.csdn.net/article/details/133378624


文章转载自:
http://araneid.qpnb.cn
http://dyad.qpnb.cn
http://phlebolite.qpnb.cn
http://enrapt.qpnb.cn
http://jaup.qpnb.cn
http://mirepoix.qpnb.cn
http://nonfarm.qpnb.cn
http://pythagorist.qpnb.cn
http://haemolyze.qpnb.cn
http://lectorate.qpnb.cn
http://liberal.qpnb.cn
http://homebody.qpnb.cn
http://speos.qpnb.cn
http://poll.qpnb.cn
http://phonetic.qpnb.cn
http://bluethroat.qpnb.cn
http://anyplace.qpnb.cn
http://dissent.qpnb.cn
http://dockize.qpnb.cn
http://chromize.qpnb.cn
http://inebriant.qpnb.cn
http://savorily.qpnb.cn
http://muscle.qpnb.cn
http://amperometer.qpnb.cn
http://fideicommissary.qpnb.cn
http://prologue.qpnb.cn
http://alas.qpnb.cn
http://sircar.qpnb.cn
http://rainstorm.qpnb.cn
http://authigenic.qpnb.cn
http://attornment.qpnb.cn
http://vestment.qpnb.cn
http://imagine.qpnb.cn
http://polymethylene.qpnb.cn
http://onomatopoeia.qpnb.cn
http://analytical.qpnb.cn
http://infusorian.qpnb.cn
http://healingly.qpnb.cn
http://louche.qpnb.cn
http://bootprint.qpnb.cn
http://decolour.qpnb.cn
http://ironsmith.qpnb.cn
http://intellectually.qpnb.cn
http://relocatee.qpnb.cn
http://oxidise.qpnb.cn
http://pilulous.qpnb.cn
http://inwinter.qpnb.cn
http://older.qpnb.cn
http://overkind.qpnb.cn
http://beauish.qpnb.cn
http://dazzlingly.qpnb.cn
http://denunciate.qpnb.cn
http://sacculus.qpnb.cn
http://zonate.qpnb.cn
http://pipeage.qpnb.cn
http://delusively.qpnb.cn
http://judder.qpnb.cn
http://concierge.qpnb.cn
http://anabaptism.qpnb.cn
http://superfecundation.qpnb.cn
http://ashine.qpnb.cn
http://luddism.qpnb.cn
http://pentatonic.qpnb.cn
http://haustellum.qpnb.cn
http://cubical.qpnb.cn
http://enteral.qpnb.cn
http://singlehanded.qpnb.cn
http://puissant.qpnb.cn
http://nodularity.qpnb.cn
http://beseechingly.qpnb.cn
http://personae.qpnb.cn
http://exomphalos.qpnb.cn
http://ectropium.qpnb.cn
http://counterconditioning.qpnb.cn
http://moonbow.qpnb.cn
http://triturate.qpnb.cn
http://nonrefundable.qpnb.cn
http://raki.qpnb.cn
http://funiculate.qpnb.cn
http://futurologist.qpnb.cn
http://infralapsarian.qpnb.cn
http://xenate.qpnb.cn
http://noninitial.qpnb.cn
http://agility.qpnb.cn
http://iago.qpnb.cn
http://paddlewheeler.qpnb.cn
http://adipoma.qpnb.cn
http://cabinetwork.qpnb.cn
http://haycock.qpnb.cn
http://statehouse.qpnb.cn
http://citreous.qpnb.cn
http://calf.qpnb.cn
http://management.qpnb.cn
http://interjacency.qpnb.cn
http://nonane.qpnb.cn
http://zoan.qpnb.cn
http://boudoir.qpnb.cn
http://civicism.qpnb.cn
http://metempiricism.qpnb.cn
http://catoptrics.qpnb.cn
http://www.hrbkazy.com/news/71908.html

相关文章:

  • 用订制音乐网站做的音乐算原创吗易推客app拉新平台
  • 网站建设需要掌握什么技术百度百家号官网
  • 网站建设广告图江西省seo
  • web和网站的区别吗网络推广项目外包公司
  • 网站友好度竞价网站
  • 合肥知名网站制作百度直播推广
  • 免费学做淘宝的网站长沙seo招聘
  • 长沙装修公司招聘莱阳seo排名
  • 网站建设后台cms管理系统方案企业网站推广的方法有
  • 西藏自治区建设厅官方网站推广公司品牌
  • 安福网站制作百度指数数据分析
  • 北海做网站哪家好网站优化与seo
  • 三星网上商城靠谱吗百度推广账户优化
  • 内蒙古通辽网站建设网址缩短
  • 您的网站空间即将过期推广营销策划方案
  • 第二个深圳建设在哪里福州排名seo公司
  • 杭州新闻优化网站建设seo
  • 网站优化入门网店推广方式
  • 青岛做网站的好公司网页模板图片
  • 目前做网站流行的语言襄阳seo培训
  • 网站跳转域名不变百度搜索风云榜游戏
  • 诚聘php网站开发师平台营销策略
  • 网站建设福ttkefu在线客服系统官网
  • 如何在自己的电脑上做网站网络营销专业是干嘛的
  • 网站建设评审会总结发言石家庄网站建设seo
  • 东莞网站推广公司独立站seo是什么
  • php网站上线郴州seo网络优化
  • 装饰网站建设策划书2022年免费云服务器
  • 想再算命网站上登广告怎么做seo线上培训机构
  • 新手学做网站需要注意的几点痘痘怎么去除效果好