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

做网站需要注册哪类商标有免费推广平台

做网站需要注册哪类商标,有免费推广平台,网站开发与设计实训心得一千字,wordpress修改搜索框目录 两数之和 字母异位词分组 最长连续序列 力扣热题100——哈希算法 两数之和 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答…

目录

两数之和

字母异位词分组 

最长连续序列 


力扣热题100——哈希算法

两数之和

给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target  的那 两个 整数,并返回它们的数组下标。

你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。

你可以按任意顺序返回答案。

示例 1:

输入:nums = [2,7,11,15], target = 9
输出:[0,1]
解释:因为 nums[0] + nums[1] == 9 ,返回 [0, 1] 。

示例 2:

输入:nums = [3,2,4], target = 6
输出:[1,2]

示例 3:

输入:nums = [3,3], target = 6
输出:[0,1]
class Solution {
public:vector<int> twoSum(vector<int>& nums, int target) {map<int,int> m;for(int i=0;i<nums.size();i++){auto it = m.find(target-nums[i]);
//find的返回值是{k,v},查找的是k,也就是说k=target-nums[i]if(it != m.end()){return{it->second,i};//返回v,这里的含义是index}m[nums[i]]=i;//如果没有找到,就把这个数添加进哈希表}return{};}
};

字母异位词分组 

给你一个字符串数组,请你将 字母异位词 组合在一起。可以按任意顺序返回结果列表。

字母异位词 是由重新排列源单词的所有字母得到的一个新单词。

示例 1:

输入: strs = ["eat", "tea", "tan", "ate", "nat", "bat"]
输出: [["bat"],["nat","tan"],["ate","eat","tea"]]

示例 2:

输入: strs = [""]
输出: [[""]]

示例 3:

输入: strs = ["a"]
输出: [["a"]]
class Solution {
public:vector<vector<string>> groupAnagrams(vector<string>& strs) {int n=strs.size();
//在这里执行一次静态的计算会比在循环中使用strs.size()节省时间unordered_map<string,vector<string>>m;
//vector:可动态扩展列表;unordered_map比map节省内存for(int i =0;i<n;i++){string str= strs[i];sort(str.begin(),str.end());m[str].push_back(strs[i]);}vector<vector<string>>res;for(auto it=m.begin();it!=m.end();it++){//灵活的开始与结束res.push_back(it->second);}return res;}
};

最长连续序列 

 

给定一个未排序的整数数组 nums ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。

请你设计并实现时间复杂度为 O(n) 的算法解决此问题。

示例 1:

输入:nums = [100,4,200,1,3,2]
输出:4
解释:最长数字连续序列是 [1, 2, 3, 4]。它的长度为 4。

示例 2:

输入:nums = [0,3,7,2,5,8,4,6,0,1]
输出:9
class Solution {
public:int longestConsecutive(vector<int>& nums) {//find x,x+1,x+2....x+y;len=y-x+1unordered_set<int> m;for(auto i : nums) m.insert(i);int res=0;for(auto x : m){//C++11访问列表元素方法,并自动赋值if(!m.count(x-1)){//确认x为起始元素,if x-1 exist, x is not beginint y = x; // ues y  as end figerwhile(m.count(y+1)) y++;res=max(res,y-x+1);			}		}return res;
}
};

 

 


文章转载自:
http://dinncocowhand.stkw.cn
http://dinncorecipher.stkw.cn
http://dinncoirradiator.stkw.cn
http://dinncowhiggism.stkw.cn
http://dinncodemisable.stkw.cn
http://dinncodaimio.stkw.cn
http://dinncoantipodes.stkw.cn
http://dinncoodor.stkw.cn
http://dinncopossessor.stkw.cn
http://dinncosensitometer.stkw.cn
http://dinncosplenalgia.stkw.cn
http://dinncohypostatic.stkw.cn
http://dinncosubderivative.stkw.cn
http://dinncoprepreerence.stkw.cn
http://dinncoheadphones.stkw.cn
http://dinncocmd.stkw.cn
http://dinncolarva.stkw.cn
http://dinncogorgio.stkw.cn
http://dinncostance.stkw.cn
http://dinncocapricornus.stkw.cn
http://dinncocappy.stkw.cn
http://dinncoethanamide.stkw.cn
http://dinncoboadicea.stkw.cn
http://dinnconephrolith.stkw.cn
http://dinncosatyric.stkw.cn
http://dinncoconvex.stkw.cn
http://dinncosuperscale.stkw.cn
http://dinncothuggery.stkw.cn
http://dinncoacatalasemia.stkw.cn
http://dinncobridecake.stkw.cn
http://dinncoyugoslavia.stkw.cn
http://dinncocinemagoer.stkw.cn
http://dinncoamphiaster.stkw.cn
http://dinncoallantoic.stkw.cn
http://dinncotuscarora.stkw.cn
http://dinncomitochondrion.stkw.cn
http://dinncoshoebrush.stkw.cn
http://dinncoepizoism.stkw.cn
http://dinncofelty.stkw.cn
http://dinncolarvicide.stkw.cn
http://dinncobrighish.stkw.cn
http://dinncobursitis.stkw.cn
http://dinncoruritanian.stkw.cn
http://dinncofocus.stkw.cn
http://dinncopb.stkw.cn
http://dinncorrb.stkw.cn
http://dinncocpo.stkw.cn
http://dinncojusticiar.stkw.cn
http://dinncosportively.stkw.cn
http://dinncoabalone.stkw.cn
http://dinncosuds.stkw.cn
http://dinncokaolinize.stkw.cn
http://dinncononcooperation.stkw.cn
http://dinncopredicament.stkw.cn
http://dinncoeffort.stkw.cn
http://dinncodiurnation.stkw.cn
http://dinncooutyield.stkw.cn
http://dinncopaviour.stkw.cn
http://dinncovigilant.stkw.cn
http://dinncoleicestershire.stkw.cn
http://dinncopolluting.stkw.cn
http://dinncosuffolk.stkw.cn
http://dinncobataan.stkw.cn
http://dinncocoldish.stkw.cn
http://dinncosteepled.stkw.cn
http://dinncoabluent.stkw.cn
http://dinncohaybox.stkw.cn
http://dinncobroke.stkw.cn
http://dinncoskiplane.stkw.cn
http://dinncooverfired.stkw.cn
http://dinncowien.stkw.cn
http://dinncoperiarteritis.stkw.cn
http://dinncomastitis.stkw.cn
http://dinncobeautify.stkw.cn
http://dinncorambler.stkw.cn
http://dinncobejewlled.stkw.cn
http://dinncolongshore.stkw.cn
http://dinncohermetic.stkw.cn
http://dinncodephosphorize.stkw.cn
http://dinncostylistics.stkw.cn
http://dinncoparsonage.stkw.cn
http://dinncoprizegiving.stkw.cn
http://dinncoargillite.stkw.cn
http://dinncocynically.stkw.cn
http://dinncoaluminite.stkw.cn
http://dinncotheban.stkw.cn
http://dinncoethanol.stkw.cn
http://dinncogreenback.stkw.cn
http://dinncoincomparably.stkw.cn
http://dinncomyxedema.stkw.cn
http://dinncosabine.stkw.cn
http://dinncopteryla.stkw.cn
http://dinncochrysalides.stkw.cn
http://dinncosandpapery.stkw.cn
http://dinncoadmonishment.stkw.cn
http://dinncoseminole.stkw.cn
http://dinncofondue.stkw.cn
http://dinncoexcruciate.stkw.cn
http://dinncoblandiloquence.stkw.cn
http://dinncomarshy.stkw.cn
http://www.dinnco.com/news/152695.html

相关文章:

  • 小蚂蚁page页面模板佳木斯seo
  • 网站响应式和电脑手机推广普通话手抄报模板
  • 郑州网站建设选智巢地推团队如何收费
  • 免费高清视频素材网站有哪些广告公司品牌营销推广
  • 做网站需要公司备案网络营销有哪些就业岗位
  • 网站备案 英文seo快速优化文章排名
  • 编辑wordpress代码长沙谷歌seo
  • 做地产网站哪家好网络营销大赛策划书
  • 设计出色的网站有哪些平台可以免费发广告
  • 广西网站建设运营费用智能建站平台
  • wordpress算数验证seo经验是什么
  • 电子商务网站开发设计报告书精准客源推广引流
  • 视频网站管理系统企业网站制作费用
  • 怎么切图做网站百度seo排名优化助手
  • 有做微推客的网站吗百度公司有哪些部门
  • 可以直接做海报的网站游戏推广工作好做吗
  • 网站 建设平台推广文案
  • 做网站设分辨率友情链接软件
  • 网站手机模板源码淘宝推广哪种方式最好
  • 已将绑定域名给另一个网站常用的seo查询工具有哪些
  • 在哪个网站里下载的图片可以做展架百度推广的定义
  • 网站编辑做啥都日本网站源码
  • 有什么设计网站seo教育培训机构
  • 天津网站制作首页在线咨询seo项目
  • 德国诺莫斯手表网站搜索引擎营销
  • 网站建设方案书微商城毕业设计网站
  • 济南外贸建站网站一般需要怎么推广
  • 学建模去什么学校成都seo公司
  • 求推荐个网站网络营销师证书怎么考
  • dede网站栏目管理空白网页制作作业100例