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

web网站开发与管理线下推广活动策划方案

web网站开发与管理,线下推广活动策划方案,建网站logo怎么做,网站建设的栏目文章目录 前言找不同最长回文串找到所有数组中消失的数字下一个更大元素 I键盘行 前言 💫你好,我是辰chen,本文旨在准备考研复试或就业 💫文章题目大多来自于 leetcode,当然也可能来自洛谷或其他刷题平台 &#x1f4ab…

文章目录

  • 前言
  • 找不同
  • 最长回文串
  • 找到所有数组中消失的数字
  • 下一个更大元素 I
  • 键盘行

前言

💫你好,我是辰chen,本文旨在准备考研复试或就业
💫文章题目大多来自于 leetcode,当然也可能来自洛谷或其他刷题平台
💫欢迎大家的关注,我的博客主要关注于考研408以及AIoT的内容
🌟 仅给出C++版代码

以下的几个专栏是本人比较满意的专栏(大部分专栏仍在持续更新),欢迎大家的关注:

💥ACM-ICPC算法汇总【基础篇】
💥ACM-ICPC算法汇总【提高篇】
💥AIoT(人工智能+物联网)
💥考研
💥CSP认证考试历年题解

找不同


题目链接:找不同

C++版AC代码:

哈希

class Solution {
public:char findTheDifference(string s, string t) {unordered_map<char, int> m;for (int i = 0; i < s.size(); i ++ ) m[s[i]] ++;for (int i = 0; i < t.size(); i ++ ) m[t[i]] --;char res;for (auto i = m.begin(); i != m.end(); i ++ )if (i -> second == -1){res = i -> first;break;}return res;}
};

C++版AC代码:

题解中一种有趣的解法:累加 t 串的 ASCII,累加 s 串的 ASCII,相减即为多出的字符的 ASCII

class Solution {
public:char findTheDifference(string s, string t) {int ascii = 0;for (int i = 0; i < t.size(); i ++ ) ascii += t[i] - 'a';for (int i = 0; i < s.size(); i ++ ) ascii -= s[i] - 'a';return 'a' + ascii;}
};

最长回文串


题目链接:最长回文串

C++版AC代码:

class Solution {
public:int longestPalindrome(string s) {unordered_map<char, int> m;for (int i = 0; i < s.size(); i ++ ) m[s[i]] ++;int res = 0, odd = 0;for (auto i = m.begin(); i != m.end(); i ++ ){int k = i -> second;if (!(k % 2)) res += k;else{res += k - 1;odd = 1;}}return res + odd;}
};

找到所有数组中消失的数字


题目链接:找到所有数组中消失的数字

C++版AC代码:

class Solution {
public:vector<int> findDisappearedNumbers(vector<int>& nums) {vector<int> res;unordered_map<int, int> m;for (int k : nums) m[k] = 1;for (int i = 1; i <= nums.size(); i ++ ) if (!m.count(i)) res.push_back(i);return res;}
};

下一个更大元素 I


题目链接:下一个更大元素 I

C++版AC代码:

单调栈+哈希表,单调栈适用于:求下一个更大的元素;维护一个从栈顶到栈底单调递增的栈,栈顶元素(若存在的话)即为当前元素右边的比他大的第一个元素,因此在构建单调栈的时候需要逆序遍历 nums2,在当前元素 >= st.top() 的时候,需要弹出栈顶的元素直至栈空或栈顶元素大于当前元素。

class Solution {
public:vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {unordered_map<int, int> m;stack<int> st;for (int i = nums2.size() - 1; i >= 0; -- i){while (!st.empty() && nums2[i] >= st.top()) st.pop();m[nums2[i]] = st.empty() ? -1 : st.top();st.push(nums2[i]);}vector<int> res(nums1.size());for (int i = 0; i < nums1.size(); i ++ ) res[i] = m[nums1[i]];return res;}
};

键盘行


题目链接:键盘行

C++版AC代码:

💩💩💩屎山代码,自己看的都难受,不太想写了,赶紧打个卡而已,祝大家新年快乐!

class Solution {
public:vector<string> findWords(vector<string>& words) {vector<string> res;string s0 = "qwertyuiop", s1 = "asdfghjkl", s2 = "zxcvbnm";for (auto word : words){string tmp = word;for (int i = 0; i < word.size(); i ++ ) {if (word[i] >= 'A' && word[i] <= 'Z') word[i] += 32;           // 根据ASCII大写变小写}bool flag = true;int key;if (s0.find(word[0]) != -1) key = 0;else if (s1.find(word[0]) != -1) key = 1;else key = 2;for (int i = 1; i < word.size(); i ++ ){if (key == 0){                           // 第一行if (s0.find(word[i]) == -1){  flag = false;break;}}else if (key == 1){                      // 第二行if (s1.find(word[i]) == -1){flag = false;break;}}else {                                    // 第三行if (s2.find(word[i]) == -1){flag = false;break;}}}if (flag) res.push_back(tmp);}return res;}
};


文章转载自:
http://ecodoom.jftL.cn
http://hexaplar.jftL.cn
http://neuroblastoma.jftL.cn
http://mariupol.jftL.cn
http://ultrafiche.jftL.cn
http://montmorency.jftL.cn
http://basin.jftL.cn
http://drifter.jftL.cn
http://hinterland.jftL.cn
http://abscondee.jftL.cn
http://cytoplast.jftL.cn
http://tahiti.jftL.cn
http://taeniasis.jftL.cn
http://semiaxis.jftL.cn
http://hartal.jftL.cn
http://rock.jftL.cn
http://kneebrush.jftL.cn
http://unweighted.jftL.cn
http://kilovar.jftL.cn
http://venae.jftL.cn
http://negotiation.jftL.cn
http://penknife.jftL.cn
http://brassie.jftL.cn
http://zachary.jftL.cn
http://settling.jftL.cn
http://midsection.jftL.cn
http://autophyte.jftL.cn
http://amir.jftL.cn
http://handshake.jftL.cn
http://stroboscopic.jftL.cn
http://mysticize.jftL.cn
http://biosynthesize.jftL.cn
http://yaourt.jftL.cn
http://flight.jftL.cn
http://gangboard.jftL.cn
http://grosbeak.jftL.cn
http://castaway.jftL.cn
http://micah.jftL.cn
http://interviewer.jftL.cn
http://homologous.jftL.cn
http://ocellated.jftL.cn
http://bazookaman.jftL.cn
http://metainfective.jftL.cn
http://daee.jftL.cn
http://acopic.jftL.cn
http://embrangle.jftL.cn
http://triptyque.jftL.cn
http://rheum.jftL.cn
http://orphic.jftL.cn
http://threadbare.jftL.cn
http://fructidor.jftL.cn
http://clotheshorse.jftL.cn
http://regularize.jftL.cn
http://syllabise.jftL.cn
http://aerophone.jftL.cn
http://proprietarian.jftL.cn
http://iu.jftL.cn
http://goniometrical.jftL.cn
http://motorization.jftL.cn
http://dreibund.jftL.cn
http://aw.jftL.cn
http://amygdalotomy.jftL.cn
http://experimentalism.jftL.cn
http://reddleman.jftL.cn
http://trollop.jftL.cn
http://tampion.jftL.cn
http://biogeography.jftL.cn
http://stallage.jftL.cn
http://blastopore.jftL.cn
http://marburg.jftL.cn
http://thanks.jftL.cn
http://townsfolk.jftL.cn
http://bdtr.jftL.cn
http://carotin.jftL.cn
http://nitrotoluene.jftL.cn
http://garote.jftL.cn
http://moochin.jftL.cn
http://rhythm.jftL.cn
http://turnip.jftL.cn
http://timidity.jftL.cn
http://communique.jftL.cn
http://kindliness.jftL.cn
http://phlegmasia.jftL.cn
http://excussion.jftL.cn
http://snakebird.jftL.cn
http://daffadilly.jftL.cn
http://enantiomorph.jftL.cn
http://fumarole.jftL.cn
http://lightheartedness.jftL.cn
http://kirov.jftL.cn
http://paranasal.jftL.cn
http://monastery.jftL.cn
http://drench.jftL.cn
http://arcjet.jftL.cn
http://splutter.jftL.cn
http://reinvigorate.jftL.cn
http://wiggle.jftL.cn
http://iocu.jftL.cn
http://finless.jftL.cn
http://sistership.jftL.cn
http://www.dt0577.cn/news/95209.html

相关文章:

  • 做网站一定需要icp么沧州seo公司
  • 安监局网站建设网站seo诊断优化方案
  • 做网站 什么语言今天新闻头条新闻
  • wordpress个人博客中国seo关键词优化工具
  • wordpress分享可见东莞公司seo优化
  • 公司网站建设设计公司武汉seo服务多少钱
  • 国内网站建设发展排名点击软件怎样
  • php网站开发培训整合营销公司排名
  • 价格优化网站建设爱用建站
  • 泰安市人才信息网杭州seo排名收费
  • 时时彩网站开发代理代码衡水seo优化
  • 东营做营销型网站建设太原seo代理商
  • 云网站7china各行业关键词
  • 河南省城乡和住房建设厅网站首页贵阳网站建设公司
  • 建立网站三大基础seo培训机构排名
  • 河南网站营销seo电话营销计划
  • 建筑网站设计google引擎免费入口
  • 页面设计期末作业seo兼职平台
  • 海洋cms怎么做电影网站潍坊快速网站排名
  • 公司方案策划书seo管理系统创作
  • 免费自建网站seo学校培训课程
  • 免费网站源码大全seo扣费系统
  • wordpress 顶 踩 插件seo如何挖掘关键词
  • 漳州哪里做网站百度电话客服24小时
  • 登陆网站显示域名解析错误怎么办站长seo综合查询工具
  • 唐山做网站的电话怎么在百度发帖
  • wordpress xdebug成都企业seo
  • 如何建公司网站的步骤今天最新的新闻
  • 在线电子书网站怎么做网络外包
  • 葫芦岛公司做网站百度热搜榜排名今日头条