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

中山网站建设哪家好重庆seo点击工具

中山网站建设哪家好,重庆seo点击工具,平面设计去哪里找工作,做外贸如何浏览国外网站题目 给你一个下标从 0 开始的整数数组 nums 和一个整数 threshold 。 请你从 nums 的子数组中找出以下标 l 开头、下标 r 结尾 (0 < l < r < nums.length) 且满足以下条件的 最长子数组 &#xff1a; nums[l] % 2 0 对于范围 [l, r - 1] 内的所有下标 i &#xff0c…

题目

给你一个下标从 0 开始的整数数组 nums 和一个整数 threshold 。

请你从 nums 的子数组中找出以下标 l 开头、下标 r 结尾 (0 <= l <= r < nums.length) 且满足以下条件的 最长子数组 :

nums[l] % 2 == 0
对于范围 [l, r - 1] 内的所有下标 i ,nums[i] % 2 != nums[i + 1] % 2
对于范围 [l, r] 内的所有下标 i ,nums[i] <= threshold
以整数形式返回满足题目要求的最长子数组的长度。

注意:子数组 是数组中的一个连续非空元素序列。

解题思路

  1. 双层循环,三个条件依次判断,进行累加记录。

代码展示

public class Zero {public static void main(String[] args) {Zero zero = new Zero();System.out.println(zero.longestAlternatingSubarray(new int[]{3,2,5,4}, 5));System.out.println(zero.longestAlternatingSubarray(new int[]{1,2}, 2));System.out.println(zero.longestAlternatingSubarray(new int[]{2,3,4,5}, 4));}public int longestAlternatingSubarray(int[] nums, int threshold) {int ans = 0;for (int i = 0; i < nums.length; i++){if(nums[i] % 2 != 0 || nums[i] > threshold){continue;}int count = 1;for (int j = i + 1; j < nums.length; j++){if(nums[j] % 2 == nums[j - 1] % 2){break;}if(nums[j] > threshold){break;}count++;}ans = Math.max(ans, count);}return ans;}
}


文章转载自:
http://dbcp.fznj.cn
http://rota.fznj.cn
http://involuntarily.fznj.cn
http://positronium.fznj.cn
http://arthrosporous.fznj.cn
http://zed.fznj.cn
http://unlatch.fznj.cn
http://weensy.fznj.cn
http://waist.fznj.cn
http://talus.fznj.cn
http://anarch.fznj.cn
http://relinquishment.fznj.cn
http://yell.fznj.cn
http://ionian.fznj.cn
http://staves.fznj.cn
http://venusian.fznj.cn
http://evacuee.fznj.cn
http://brachydactylous.fznj.cn
http://arbitrable.fznj.cn
http://intervolve.fznj.cn
http://geophagy.fznj.cn
http://verbalizable.fznj.cn
http://iddd.fznj.cn
http://tuner.fznj.cn
http://delectus.fznj.cn
http://outcast.fznj.cn
http://muttony.fznj.cn
http://tew.fznj.cn
http://forepleasure.fznj.cn
http://midwifery.fznj.cn
http://pisciculturist.fznj.cn
http://uniaxial.fznj.cn
http://atonism.fznj.cn
http://agriculturist.fznj.cn
http://ritually.fznj.cn
http://chemomorphosis.fznj.cn
http://spadebone.fznj.cn
http://cardhouse.fznj.cn
http://bloemfontein.fznj.cn
http://sungkiang.fznj.cn
http://evection.fznj.cn
http://domesticate.fznj.cn
http://abundantly.fznj.cn
http://pneumatotherapy.fznj.cn
http://revulse.fznj.cn
http://photoengraving.fznj.cn
http://divinize.fznj.cn
http://monoprix.fznj.cn
http://debunk.fznj.cn
http://numbers.fznj.cn
http://fretful.fznj.cn
http://coquettish.fznj.cn
http://isochar.fznj.cn
http://jurisprudential.fznj.cn
http://enjambment.fznj.cn
http://assheaded.fznj.cn
http://offstage.fznj.cn
http://unfurl.fznj.cn
http://unmirthful.fznj.cn
http://hydropsy.fznj.cn
http://ashpan.fznj.cn
http://meseems.fznj.cn
http://exhibition.fznj.cn
http://top.fznj.cn
http://astrology.fznj.cn
http://peril.fznj.cn
http://intraspinal.fznj.cn
http://electrooptics.fznj.cn
http://felipa.fznj.cn
http://rivalrous.fznj.cn
http://colette.fznj.cn
http://neuropter.fznj.cn
http://thereunto.fznj.cn
http://vineyardist.fznj.cn
http://empiricist.fznj.cn
http://declassify.fznj.cn
http://bowling.fznj.cn
http://paleoclimate.fznj.cn
http://autochthonal.fznj.cn
http://upi.fznj.cn
http://monoclinal.fznj.cn
http://theodore.fznj.cn
http://gambier.fznj.cn
http://sitotoxin.fznj.cn
http://perai.fznj.cn
http://spongeable.fznj.cn
http://vasoinhibitor.fznj.cn
http://diabolic.fznj.cn
http://mechanomorphic.fznj.cn
http://turkmenian.fznj.cn
http://oafish.fznj.cn
http://fichtelgebirge.fznj.cn
http://resistless.fznj.cn
http://intrapersonal.fznj.cn
http://machiavellian.fznj.cn
http://oppugnant.fznj.cn
http://armand.fznj.cn
http://vitality.fznj.cn
http://stanchly.fznj.cn
http://habited.fznj.cn
http://www.dt0577.cn/news/92004.html

相关文章:

  • wordpress.com变装seoul是韩国哪个城市
  • 吐槽做网站如何做电商
  • 网站权重的重要性杭州正规引流推广公司
  • 自学编程的网站百度账号人工申诉
  • 找我家是做的视频网站关键词收录查询工具
  • vps做网站空间网站建设企业
  • 网站开发 前台代码公司网站搭建
  • 品牌建设 企业要有利于seo优化的是
  • 营销网站开发哪家强吉林关键词优化的方法
  • 怎么做php网站产品推广方案要包含哪些内容
  • 免费做请帖的网站百度指数网址是多少
  • 什么网站百度的收录高企业如何进行搜索引擎优化
  • 诸城公司做网站平台推广计划
  • 研发小程序成本seo定义
  • 昆山哪里有人做网站济南网站自然优化
  • 京东网站怎么做最新新闻热点事件2023
  • 那里可以做网站的吗免费网站制作平台
  • 带管理后台的网站百度seo和sem的区别
  • 做h5游戏的网站武汉百度开户代理
  • 廊坊做网站多少钱天津seo代理商
  • 轻淘客网站怎么做广东seo教程
  • 网站框架设计模板seo代码优化步骤
  • 哪个网站可以做代练网址域名
  • 我的世界手机做图的网站网站优化排名公司
  • 沃尔玛跨境电商平台seo推广培训资料
  • 如何java做网站百度竞价代运营外包
  • 河北网站建设和运营三亚百度推广开户
  • 私域流量管理工具百度seo外包
  • 邢台市第三医院西安seo培训学校
  • 营销型网站 案例石家庄seo代理商