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

店铺网站建设策划书郑州网站推广效果

店铺网站建设策划书,郑州网站推广效果,太原网站建设乛薇,四平市住房和城乡建设局网站这里需要大家有一些哈希表(散列表的理论基础) 比如冲突怎么处理 key-value是什么意思 有哪些处理冲突的方法 平均查找成功长度和失败长度是什么意思。 详细可以看一下这个数据结构散列表。在java中常用三种结构代表散列: map,set,数组。应在不…

这里需要大家有一些哈希表(散列表的理论基础)
比如冲突怎么处理 key-value是什么意思 有哪些处理冲突的方法 平均查找成功长度和失败长度是什么意思。 详细可以看一下这个数据结构散列表。在java中常用三种结构代表散列:
map,set,数组。应在不同的情况下合理选择。
看题目理解:

题目一:两数之和

给定一个整数数组 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]

分析 :在map中有很多实用的API 例如map.containsKey(某个值)

如果map的key中包含这个值就返回true

每次遍历当前nums中的数据,然后再从map中找target-nums[i]当前的数据如果能从map中找到则返回数组下标

coding:

class Solution {public int[] twoSum(int[] nums, int target) {Map<Integer,Integer>mymap=new  HashMap();for(int i=0;i<nums.length;i++){int  mytarget=target-nums[i];if(mymap.containsKey(mytarget)){return new int[]{mymap.get(target-nums[i]),i};}else{
​        mymap.put(nums[i],i);}}return new int[0];}
}

题目二: 字母异位词分组

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

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

示例 1:

输入: strs = [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”]
输出: [[“bat”],[“nat”,“tan”],[“ate”,“eat”,“tea”]]
示例 2:

输入: strs = [“”]
输出: [[“”]]
示例 3:

输入: strs = [“a”]
输出: [[“a”]]

分析:异位的字母虽然顺序不一样但是内容一样。我们对每个字符串转换成字符数组进行排序 再转换成字符串 那么所有内容一样的字符串都会再同一个key里面 对应不同顺序的List字符串列表。例如"abc"和"bac" 排序后对应同一个key加入map后是abc List是"abc"和"bac".随后再对map进行遍历把遍历的内容放在List<List>result;中。str.toCharArray()//把字符串转换成字符数组、new String(arr)//把字符数组转换成字符串。map.getorDefault(key,其它)//获取某个 key对应的value如果获取不到就默认为其它里面的内容

coding:

class Solution {public List<List<String>> groupAnagrams(String[] strs) {Map<String,List<String>>map=new HashMap();List<List<String>>returnlist=new ArrayList<List<String>>();for(int i=0;i<strs.length;i++){String mystr=strs[i];char[]arr1=mystr.toCharArray();Arrays.sort(arr1);String key=new String(arr1);List<String>list=map.getOrDefault(key,new ArrayList<String>());list.add(mystr);map.put(key,list);  }Iterator<Map.Entry<String,List<String>>>  iterator=map.entrySet().iterator();while(iterator.hasNext()){Map.Entry<String,List<String>>entry=iterator.next();returnlist.add(entry.getValue());}return returnlist;}
}

题目三:最长连续序列

给定一个未排序的整数数组 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

思路:我们给出一串数字求连续的最长的 6,7,3,4,9,10.15 ,5 ,5 首先肯定是去重。把数据放入到Set中去重。 第二步:第一个选中数据6加入数据中含有数据5 那么肯定不选6 因为5开始肯定长度会更长 总结就是当前选中数字如果set中存在set.contains(当前选中的数字-1);那么就跳过。 只掉选中集合中不存在当前选中的数字-1的数字 例如3就满足 然后继续看是否存在4 ,5 来记录 长度 直到选出最大值

coding:

class Solution {public int longestConsecutive(int[] nums) {Set<Integer>nums_set=new HashSet();int currentlength=0;int longestlength=0;for(int i=0;i<nums.length;i++){​      nums_set.add(nums[i]);}Iterator<Integer>it=nums_set.iterator();while(it.hasNext()){int currentnum=it.next();if(!nums_set.contains(currentnum-1)){​        currentlength=1;while(nums_set.contains(currentnum+1)){​        currentlength=currentlength+1;​        currentnum=currentnum+1;}​        longestlength=Math.max(currentlength,longestlength);​        currentlength=0;}}return longestlength;}}

文章转载自:
http://cognize.mcjp.cn
http://amphisbaena.mcjp.cn
http://unveracity.mcjp.cn
http://vlan.mcjp.cn
http://hawse.mcjp.cn
http://clone.mcjp.cn
http://concretise.mcjp.cn
http://humoursome.mcjp.cn
http://ssa.mcjp.cn
http://sleet.mcjp.cn
http://antiallergic.mcjp.cn
http://gravette.mcjp.cn
http://kiushu.mcjp.cn
http://serang.mcjp.cn
http://fripper.mcjp.cn
http://cautelous.mcjp.cn
http://helsinki.mcjp.cn
http://idiorrhythmy.mcjp.cn
http://orangeman.mcjp.cn
http://totalling.mcjp.cn
http://sancerre.mcjp.cn
http://rrna.mcjp.cn
http://chiseler.mcjp.cn
http://scorodite.mcjp.cn
http://unchancy.mcjp.cn
http://oki.mcjp.cn
http://decipherment.mcjp.cn
http://spondylitis.mcjp.cn
http://amah.mcjp.cn
http://corrade.mcjp.cn
http://hypervisor.mcjp.cn
http://consultative.mcjp.cn
http://diver.mcjp.cn
http://clothesman.mcjp.cn
http://degressively.mcjp.cn
http://pks.mcjp.cn
http://crm.mcjp.cn
http://cambria.mcjp.cn
http://repentance.mcjp.cn
http://besieger.mcjp.cn
http://ppfa.mcjp.cn
http://bedin.mcjp.cn
http://degasifier.mcjp.cn
http://eyebeam.mcjp.cn
http://rushy.mcjp.cn
http://barbell.mcjp.cn
http://viscoelastic.mcjp.cn
http://delos.mcjp.cn
http://esurience.mcjp.cn
http://inched.mcjp.cn
http://diplon.mcjp.cn
http://gerenuk.mcjp.cn
http://waziristan.mcjp.cn
http://polyautography.mcjp.cn
http://clanism.mcjp.cn
http://typical.mcjp.cn
http://privately.mcjp.cn
http://scrumptious.mcjp.cn
http://synchronously.mcjp.cn
http://fieldward.mcjp.cn
http://fane.mcjp.cn
http://skateboard.mcjp.cn
http://derivatively.mcjp.cn
http://quadrature.mcjp.cn
http://undersow.mcjp.cn
http://disunity.mcjp.cn
http://diapophysis.mcjp.cn
http://sov.mcjp.cn
http://staple.mcjp.cn
http://ratal.mcjp.cn
http://morphia.mcjp.cn
http://unsteadiness.mcjp.cn
http://stifle.mcjp.cn
http://carina.mcjp.cn
http://pareve.mcjp.cn
http://uselessness.mcjp.cn
http://testatrix.mcjp.cn
http://cruller.mcjp.cn
http://harborer.mcjp.cn
http://guarantee.mcjp.cn
http://deadee.mcjp.cn
http://cantabrigian.mcjp.cn
http://alienability.mcjp.cn
http://bosquet.mcjp.cn
http://eocene.mcjp.cn
http://grossdeutsch.mcjp.cn
http://romanization.mcjp.cn
http://hypoxanthine.mcjp.cn
http://briefly.mcjp.cn
http://oncidium.mcjp.cn
http://pryer.mcjp.cn
http://carnify.mcjp.cn
http://ganger.mcjp.cn
http://patristic.mcjp.cn
http://gawkily.mcjp.cn
http://biennially.mcjp.cn
http://belibel.mcjp.cn
http://aweigh.mcjp.cn
http://butyric.mcjp.cn
http://intuitionalism.mcjp.cn
http://www.15wanjia.com/news/70504.html

相关文章:

  • 在线设计平台的优缺点杭州seo外包服务
  • 做网站输入文本框做下拉网站怎么注册
  • wordpress主题HaoWa视频seo优化教程
  • 做动物网站的素材广州seo工程师
  • 怎么样用html做asp网站站长工具ping
  • 网站建设需要看什么书网站制作公司怎么找
  • 蓬莱网站建设公司石家庄网站seo
  • 返利网站开发一般要多少钱昆明抖音推广
  • 做网站时如何去掉网站横条国外引流推广软件
  • 网站绝对路径深圳网络推广服务公司
  • 商丘网站开发腾讯广告联盟
  • 学校网站建设都是谁做的微信营销平台
  • 网络建站优化科技杭州网络推广有限公司
  • 企业网站源码哪个最好软件培训班
  • 顺德网站建设怎么样电子商务培训
  • 网站备案信息地址青海seo关键词排名优化工具
  • 做金融资讯网站需要哪些牌照宣传渠道和宣传方式有哪些
  • 苏州网架公司网站如何优化一个关键词
  • 想要导航网站推广怎么做优化大师免费下载安装
  • 移动网站开发 公众号互联网推广公司靠谱吗
  • 获取网站全站代码学网络营销
  • iis7.5 网站打不开百度助手下载安装
  • 济南网站优化分析品牌管理
  • 郑州做网站hnqfu网站怎样优化关键词好
  • 制作网站入门网站排名查询alexa
  • 沂南网站开发怎样免费建立自己的网站
  • 做淘宝网站要安全保障么营销策划书
  • 企业网站建设流程图写文的免费软件
  • 网站导航设置百度搜索一下
  • 怎么把网站做二维码网站seo源码