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

购物网站建立手机网页微信

购物网站建立,手机网页微信,深圳设计之都,wordpress清除插件差分数组–前缀和数组的升级 LeetCode 1109 航班预定统计 2024.1.1 题目链接labuladong讲解[链接] class Solution { public:vectorint corpFlightBookings(vectorvectorint bookings, int n) {//构建航班人数数组#xff0c;数组大小为n,初…差分数组–前缀和数组的升级 LeetCode 1109 航班预定统计 2024.1.1 题目链接labuladong讲解[链接] class Solution { public:vectorint corpFlightBookings(vectorvectorint bookings, int n) {//构建航班人数数组数组大小为n,初始化为0vectorint people(n, 0);//将人数传入差分类中构造差分数组Diff diff(people);//遍历每条预定记录从bookings[i][0]-1与索引差1开始人数增加从bookings[i][1]位置人数减少至原来for(int i 0; i bookings.size(); i){int from bookings[i][0]-1;int to bookings[i][1];int num bookings[i][2];//更新差分数组从bookings[i][0]-1与索引差1开始人数增加从bookings[i][1]位置人数减少至原来diff.increment(from, to, num);}//更新people数组需要初始化people[0]people[0] diff.diffnum[0];for(int i 1; i n; i)people[i] people[i-1]diff.diffnum[i];//返回更新后的数组return people;}class Diff{public:vectorint diffnum;Diff(vectorint people){diffnum vectorint(people.size(), 0);}void increment(int from, int to, int num){diffnum[from] num;if(to diffnum.size())diffnum[to] - num;}}; };花式遍历 LeetCode 151 反转字符串里的单词 2024.1.1 题目链接labuladong讲解[链接] class Solution { public:string reverseWords(string s) {//用栈来实现/*stackchar st;string str;for(int i s.size()-1; i 0; i--){if(s[i] st.empty())continue;while(s[i] !st.empty()){str.push_back(st.top());st.pop();}if(s[i] )str.push_back( ); if(s[i] ! )st.push(s[i]);}while(!st.empty()){str.push_back(st.top());st.pop();}if(str[str.size()-1] )str.pop_back();return str;*///先双指针移出不必要的空格再整体反转最后将每个单词反转即可得到答案//移除不必要空格int slow 0;for(int i 0; i s.size(); i){if(slow ! 0 s[i] ! )s[slow] ;while(i s.size() s[i] ! )s[slow] s[i];}s.resize(slow);//整体反转reverse(s.begin(), s.end());//最后将每个单词反转即可得到答案int left 0;for(int i 0; i s.size(); i){if(s[i] ){reverse(s.begin()left, s.begin()i);left i 1;}}reverse(s.begin()left, s.end());return s;} };
http://www.hkea.cn/news/14536441/

相关文章:

  • 上海尚海整装官方网站网站建设服务哪个便宜啊
  • 余杭建设局网站微信小程序开发制作教程
  • wordpress站点目录晋江网络推广公司
  • 淘宝客网站做一种还是做好几种seo推广是什么
  • 大沥做网站东莞做网站seo优化
  • 江苏省 建设 注册中心网站首页域名收录查询
  • 网站建设价格表金融行业网站建设公司
  • 优秀企业网站的特点flash 网站欣赏
  • 微信上的小说网站是怎么做的佛山定制建站公司推荐
  • 游戏网站怎么做营销qq下载
  • 怎么创建卡密网站工商网核名查询
  • 做吃穿住行网站好品牌设计公司
  • 公司网站搭建费用哈尔滨市建设厅网站
  • 信息产业部网站备案做网站为什么赚钱
  • 专业微信网站建设1688官网首页官网
  • 博物馆门户网站建设方案天猫优惠卷怎么做网站
  • 济南建网站公司报价商城类网站和o2o网站
  • 大尺度做爰后入网站移动端app开发
  • 为什么网站建设要将access数据库文件变成asa网站需求建设书
  • 免费网站加速器建设软件资源网站
  • 建设网站的结束语广州企业注册一网通
  • 太原站扩建自媒体交易网站开发
  • 易语言可以做网站嘛在线crm视频在线crm免
  • 网站建设技术协议书天津圣辉友联做网站
  • seo网站推广是什么意思互联网下载
  • 怎样做自己介绍网站网站建设公司重庆
  • 做网站js还是jq营销策划公司介绍
  • 数码产品网站建设策划书如何 做网站跳转
  • 遵义网站建设公司高端产业主要指哪些领域
  • 品牌网站建设四川wordpress形式