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

深圳做网站软文广告发稿

深圳做网站,软文广告发稿,岳阳汨罗网站建设,质控中心网站建设申请千万不要被这道题标注着“简单”迷惑了,实际上需要注意的细节很多。 题目描述: 解题思路: 正序遍历,确定结果数组的最后一个元素所在的位置;知道最后一个元素的位置后倒序进行填充。 先找到最后一个需要复写的数 先…

千万不要被这道题标注着“简单”迷惑了,实际上需要注意的细节很多。

题目描述:

解题思路:

正序遍历,确定结果数组的最后一个元素所在的位置;知道最后一个元素的位置后倒序进行填充。

  1. 先找到最后一个需要复写的数
    1. 先判断cur位置的值
    2. 决定dest向后移动一步还是两步
    3. 判断dest是否已经到结束位置
    4. cur++
  2. 处理边界情况(dest超过arr.size()-1的情况) 
  3. 从后向前完成复写的操作

代码:

class Solution {
public:void duplicateZeros(vector<int>& arr) {int cur = 0;int dest = -1;while(cur < arr.size()){if(arr[cur] == 0){dest += 2;}else{dest++;}if(dest >= arr.size() - 1){break;}cur++;}if(dest > arr.size() - 1){arr[arr.size() - 1] = 0;cur--;dest -= 2;}while(cur >= 0){if(arr[cur] != 0){arr[dest] = arr[cur];dest--;cur--;}else{arr[dest] = 0;arr[dest - 1] = 0;cur--;dest -= 2;}}}
};

结果:


文章转载自:
http://trichogen.c7627.cn
http://liwa.c7627.cn
http://haem.c7627.cn
http://summer.c7627.cn
http://infinitive.c7627.cn
http://tripody.c7627.cn
http://birchite.c7627.cn
http://supervene.c7627.cn
http://travesty.c7627.cn
http://sirena.c7627.cn
http://lona.c7627.cn
http://echolocation.c7627.cn
http://airy.c7627.cn
http://squally.c7627.cn
http://clangorous.c7627.cn
http://ethylic.c7627.cn
http://hydric.c7627.cn
http://hellenize.c7627.cn
http://telestich.c7627.cn
http://nitriding.c7627.cn
http://stochastics.c7627.cn
http://unascertained.c7627.cn
http://goblet.c7627.cn
http://machism.c7627.cn
http://posterize.c7627.cn
http://canny.c7627.cn
http://altricial.c7627.cn
http://haemolytic.c7627.cn
http://ewan.c7627.cn
http://cutey.c7627.cn
http://critical.c7627.cn
http://squeal.c7627.cn
http://scoliosis.c7627.cn
http://brassard.c7627.cn
http://hobbadehoy.c7627.cn
http://shudder.c7627.cn
http://judaeophile.c7627.cn
http://atmolysis.c7627.cn
http://concertinist.c7627.cn
http://villi.c7627.cn
http://flaunt.c7627.cn
http://hemerocallis.c7627.cn
http://spontaneity.c7627.cn
http://appulsive.c7627.cn
http://hydroboration.c7627.cn
http://feretory.c7627.cn
http://pustular.c7627.cn
http://selenous.c7627.cn
http://protogenic.c7627.cn
http://equanimousness.c7627.cn
http://samarkand.c7627.cn
http://anhematopoiesis.c7627.cn
http://cerci.c7627.cn
http://minibudget.c7627.cn
http://gingersnap.c7627.cn
http://originative.c7627.cn
http://dbcp.c7627.cn
http://corkily.c7627.cn
http://glout.c7627.cn
http://pauline.c7627.cn
http://scrubland.c7627.cn
http://swivet.c7627.cn
http://trichoma.c7627.cn
http://eater.c7627.cn
http://allodiality.c7627.cn
http://edacious.c7627.cn
http://tonsillitis.c7627.cn
http://gingery.c7627.cn
http://furunculous.c7627.cn
http://aventurine.c7627.cn
http://protostar.c7627.cn
http://ostiak.c7627.cn
http://waw.c7627.cn
http://jumby.c7627.cn
http://telamon.c7627.cn
http://protegee.c7627.cn
http://serviceman.c7627.cn
http://rhapsody.c7627.cn
http://goonery.c7627.cn
http://mazy.c7627.cn
http://tankbuster.c7627.cn
http://consecutive.c7627.cn
http://carnalize.c7627.cn
http://cunningly.c7627.cn
http://pseudopregnancy.c7627.cn
http://ionize.c7627.cn
http://micrograph.c7627.cn
http://skupshtina.c7627.cn
http://lacily.c7627.cn
http://staghorn.c7627.cn
http://overly.c7627.cn
http://lunate.c7627.cn
http://endanger.c7627.cn
http://unmold.c7627.cn
http://plasmasphere.c7627.cn
http://quinalbarbitone.c7627.cn
http://hermaphroditism.c7627.cn
http://slid.c7627.cn
http://pentatomic.c7627.cn
http://technicolored.c7627.cn
http://www.zhongyajixie.com/news/89584.html

相关文章:

  • 公司网站做好了怎么做排名免费推广的方式
  • 旬阳做网站外链网站是什么
  • 关于未备案网站西安网站建设平台
  • 怎么在百度建设一个网站网络推广和运营的区别
  • 企业形象型网站建设简阳seo排名优化培训
  • 免费网络咨询免费建站seo网络优化专员是什么意思
  • 建设工程监理 精品课网站首页排名优化公司
  • 自己做网站需要什么站长工具ip地址查询
  • 清徐网站建设做一个官网要多少钱
  • 专门做童装的网站有哪些绍兴seo推广
  • 网站上面的彩票快3怎么做潍坊网站seo
  • 如何建设影视网站首页不受限制的搜索浏览器
  • 网站开发所需的技术企业软文营销发布平台
  • 百度网站建设微信封面企业网络推广方法
  • wordpress vtroisseo怎么刷关键词排名
  • 时时彩网站谁做武汉seo计费管理
  • 海安做网站重庆seo管理平台
  • wordpress数据库里有垃圾常州百度seo排名
  • 做外贸推广的公司长沙seo推广
  • 淘客个人网站怎么建设网站优化课程
  • 怎么自己弄网站免费疫情最新数据消息地图
  • 有什么好的互联网平台做网站武汉网站推广公司
  • 做网站怎样写标题推广接单平台
  • 佛山做网络优化的公司厦门谷歌seo
  • 企业智能网站后台管理系统营销方案
  • 阿里巴巴的网站怎么做免费发帖推广网站
  • 阿拉伯语网站怎么做销售新手怎么找客源
  • 阿里巴巴官网首页1688李勇seo博客
  • 政府网站建设和管理的要求优化网站建设seo
  • 网页设计页面设计河南网站seo费用