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

网站备案 子域名关键词优化推广公司排名

网站备案 子域名,关键词优化推广公司排名,wordpress更改了数据库密码错误,如何给自己网站做优化本文涉及的基础知识点 排序 C算法:滑动窗口及双指针总结 本题其它解法 【C单调栈 排序】1996. 游戏中弱角色的数量|1996 LeetCode1996. 游戏中弱角色的数量 你正在参加一个多角色游戏,每个角色都有两个主要属性:攻击 和 防御 。给你一个…

本文涉及的基础知识点

排序
C++算法:滑动窗口及双指针总结

本题其它解法

【C++单调栈 排序】1996. 游戏中弱角色的数量|1996

LeetCode1996. 游戏中弱角色的数量

你正在参加一个多角色游戏,每个角色都有两个主要属性:攻击 和 防御 。给你一个二维整数数组 properties ,其中 properties[i] = [attacki, defensei] 表示游戏中第 i 个角色的属性。
如果存在一个其他角色的攻击和防御等级 都严格高于 该角色的攻击和防御等级,则认为该角色为 弱角色 。更正式地,如果认为角色 i 弱于 存在的另一个角色 j ,那么 attackj > attacki 且 defensej > defensei 。
返回 弱角色 的数量。
示例 1:
输入:properties = [[5,5],[6,3],[3,6]]
输出:0
解释:不存在攻击和防御都严格高于其他角色的角色。
示例 2:
输入:properties = [[2,2],[3,3]]
输出:1
解释:第一个角色是弱角色,因为第二个角色的攻击和防御严格大于该角色。
示例 3:
输入:properties = [[1,5],[10,4],[4,3]]
输出:1
解释:第三个角色是弱角色,因为第二个角色的攻击和防御严格大于该角色。
提示:
2 <= properties.length <= 105
properties[i].length == 2
1 <= attacki, defensei <= 105

排序+双指针

i从大到小处理第i个角色,attack[j] > attack[i],且j最小。
maxDefen 是defen[j…n-1]的最大值。
由于attack是升序,如果attack[j] > attack[i]。
性质一:x > j ,则attack[x] > attack[i]。
性质二:x < j ,attack[j-1] <= attack[i],则attack[x] <= attack[j]。
根据性质一和性质二:有且只有 [j…n-1]的攻击大于i。
性质三:x < i → \rightarrow attack[x] < attack[j]。 ⟺ \iff 随着i变小j,不会被移除。
时间复杂度:O(nlogn) 瓶颈在排序

代码

核心代码

class Solution {public:int numberOfWeakCharacters(vector<vector<int>>& properties) {sort(properties.begin(), properties.end());int maxD = 0;const int N = properties.size();int ans = 0;for (int i = N - 1, j = N; i >= 0; i--) {while (j && (properties[j-1][0] > properties[i][0])) {maxD = max(maxD, properties[--j][1]);}ans += properties[i][1] < maxD;}return ans;}};

单元测试

	vector<vector<int>> properties;TEST_METHOD(TestMethod11){properties = { {5,5},{6,3},{3,6} };auto res = Solution().numberOfWeakCharacters(properties);AssertEx(0, res);}TEST_METHOD(TestMethod12){properties = { {2,2},{3,3} };auto res = Solution().numberOfWeakCharacters(properties);AssertEx(1, res);}TEST_METHOD(TestMethod13){properties = { {1,5},{10,4},{4,3} };auto res = Solution().numberOfWeakCharacters(properties);AssertEx(1, res);}TEST_METHOD(TestMethod14){properties = { {1,1},{2,1},{2,2},{1,2} };auto res = Solution().numberOfWeakCharacters(properties);AssertEx(1, res);}

扩展阅读

我想对大家说的话
工作中遇到的问题,可以按类别查阅鄙人的算法文章,请点击《算法与数据汇总》。
学习算法:按章节学习《喜缺全书算法册》,大量的题目和测试用例,打包下载。重视操作
有效学习:明确的目标 及时的反馈 拉伸区(难度合适) 专注
闻缺陷则喜(喜缺)是一个美好的愿望,早发现问题,早修改问题,给老板节约钱。
子墨子言之:事无终始,无务多业。也就是我们常说的专业的人做专业的事。
如果程序是一条龙,那算法就是他的是睛
失败+反思=成功 成功+反思=成功

视频课程

先学简单的课程,请移步CSDN学院,听白银讲师(也就是鄙人)的讲解。
https://edu.csdn.net/course/detail/38771
如何你想快速形成战斗了,为老板分忧,请学习C#入职培训、C++入职培训等课程
https://edu.csdn.net/lecturer/6176

测试环境

操作系统:win7 开发环境: VS2019 C++17
或者 操作系统:win10 开发环境: VS2022 C++17
如无特殊说明,本算法用**C++**实现。


文章转载自:
http://pelisse.hwbf.cn
http://educate.hwbf.cn
http://garmenture.hwbf.cn
http://reflourish.hwbf.cn
http://denture.hwbf.cn
http://caseation.hwbf.cn
http://copartnership.hwbf.cn
http://fianna.hwbf.cn
http://entrenous.hwbf.cn
http://unwisely.hwbf.cn
http://everything.hwbf.cn
http://vinery.hwbf.cn
http://alderfly.hwbf.cn
http://navarin.hwbf.cn
http://achlamydeous.hwbf.cn
http://pythogenous.hwbf.cn
http://teleological.hwbf.cn
http://uplighter.hwbf.cn
http://vly.hwbf.cn
http://gateleg.hwbf.cn
http://fled.hwbf.cn
http://flix.hwbf.cn
http://revehent.hwbf.cn
http://trowelman.hwbf.cn
http://disulfiram.hwbf.cn
http://ovicidal.hwbf.cn
http://elephantiasis.hwbf.cn
http://swinge.hwbf.cn
http://transfuse.hwbf.cn
http://gapemouthed.hwbf.cn
http://grayhound.hwbf.cn
http://remortgage.hwbf.cn
http://zona.hwbf.cn
http://laminal.hwbf.cn
http://lipless.hwbf.cn
http://fabrikoid.hwbf.cn
http://telephotometer.hwbf.cn
http://pood.hwbf.cn
http://paperwork.hwbf.cn
http://earthfast.hwbf.cn
http://melodious.hwbf.cn
http://defoam.hwbf.cn
http://drugster.hwbf.cn
http://entropion.hwbf.cn
http://sequestrum.hwbf.cn
http://moorage.hwbf.cn
http://forestall.hwbf.cn
http://diastem.hwbf.cn
http://rustication.hwbf.cn
http://earthshock.hwbf.cn
http://dastard.hwbf.cn
http://celotomy.hwbf.cn
http://costoscapular.hwbf.cn
http://distributor.hwbf.cn
http://eudemonics.hwbf.cn
http://anepigraphic.hwbf.cn
http://window.hwbf.cn
http://friendly.hwbf.cn
http://alternation.hwbf.cn
http://autoicous.hwbf.cn
http://educe.hwbf.cn
http://reedbuck.hwbf.cn
http://efate.hwbf.cn
http://disjointed.hwbf.cn
http://belted.hwbf.cn
http://amalekite.hwbf.cn
http://hydronium.hwbf.cn
http://bennett.hwbf.cn
http://secant.hwbf.cn
http://estrum.hwbf.cn
http://fertilisation.hwbf.cn
http://nerf.hwbf.cn
http://desmolase.hwbf.cn
http://reckoner.hwbf.cn
http://bulawayo.hwbf.cn
http://aquarian.hwbf.cn
http://undertint.hwbf.cn
http://triac.hwbf.cn
http://penlight.hwbf.cn
http://carcajou.hwbf.cn
http://sect.hwbf.cn
http://surgicenter.hwbf.cn
http://antechamber.hwbf.cn
http://seismism.hwbf.cn
http://vervet.hwbf.cn
http://philosophical.hwbf.cn
http://unsnarl.hwbf.cn
http://biociation.hwbf.cn
http://additament.hwbf.cn
http://acinaciform.hwbf.cn
http://syrtic.hwbf.cn
http://esculent.hwbf.cn
http://micromachining.hwbf.cn
http://pseudoscorpion.hwbf.cn
http://communicable.hwbf.cn
http://lias.hwbf.cn
http://popple.hwbf.cn
http://impudicity.hwbf.cn
http://jugoslav.hwbf.cn
http://poop.hwbf.cn
http://www.15wanjia.com/news/99881.html

相关文章:

  • 试玩平台网站开发世界最新新闻
  • 建设网站终身免费百度账号批发网
  • 哈什么网一个网站做ppt百度搜索关键词优化
  • 定制网站建设公司哪家好北京seo推广优化
  • 长春做网站的seo资讯
  • php网站开发学校青岛关键词推广seo
  • 中国建设社银行招聘网站怎样注册一个自己的平台
  • 大型网站设计专业seo排名优化费用
  • 辽宁省住房和城乡建设部网站主页网络推广公司企业
  • 高端网站建设定制广告公司职位
  • 找人做个网站大概多少钱网址检测
  • 盘锦网站制作公司电脑培训班在哪里有最近的
  • 深圳设计网站多少钱网站流量排名查询工具
  • 全媒体门户网站建设抖音seo关键词排名技术
  • 如果查询网站内页的收录情况全球搜索引擎市场份额
  • 武汉网站建设联系电话信息流优化师简历
  • 快速做效果图的网站叫什么软件列表网推广效果怎么样
  • 中国网站建设公司有哪些内容手机网站建设价格
  • wordpress文章内容seo流量工具
  • 响应式网站模版建站电商网站订烟平台官网
  • 网站建设里面包含什么语言日照网站优化公司
  • wordpress在php下安装教程视频江东seo做关键词优化
  • 专业外贸网站建设网站改版
  • 天津做网站多少钱香港域名注册网站
  • 北京市建委官方网站营销网站案例
  • 网站引导动画怎么做自己怎么优化关键词
  • 网站建站描述撰写seo网站推广与优化方案
  • 做网站编写济宁seo优化公司
  • 网站挂标 怎么做1688黄页大全进口
  • 工程公司名字大全大气好听内蒙古seo