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

天津大学生专业做网站网络口碑营销的成功案例

天津大学生专业做网站,网络口碑营销的成功案例,wordpress博客插件,lol做框网站文章目录 T1 两数之和T49 字母异位词分组常用小技巧 T1 两数之和 链接:1. 两数之和 题目: 【刷题感悟】这道题用两层for循环也能做出来,但我们还是要挑战一下时间复杂度小于 O ( n 2 ) O(n^2) O(n2)的解法,不能因为它是第一道 …

文章目录

  • T1 两数之和
  • T49 字母异位词分组
  • 常用小技巧

T1 两数之和

链接:1. 两数之和
题目:
在这里插入图片描述

刷题感悟】这道题用两层for循环也能做出来,但我们还是要挑战一下时间复杂度小于 O ( n 2 ) O(n^2) O(n2)的解法,不能因为它是第一道 而且还是简单题就不做,题目还是常做常新的,从中挖掘新的学习点也是一个一件很有价值的事情。

代码:

    public int[] twoSum(int[] nums, int target) {Map<Integer, Integer> indexValueMap = new HashMap<>();for (int ii = 0; ii < nums.length; ii++) {// 把数值作为key,下标作为value好一点,因为value比key方便获取而且题目最终是希望我们返回数组下标if (indexValueMap.containsKey(target - nums[ii])) {// 初始化数组的方法return new int[] {ii, indexValueMap.get(target - nums[ii])};}indexValueMap.put(nums[ii], ii);}// 返回一个空数组return new int[] {};}

T49 字母异位词分组

链接:49. 字母异位词分组
题目:
在这里插入图片描述
代码:

    public List<List<String>> groupAnagrams(String[] strs) {// 1. Map<String, String> -> Map<单词字典序, 单词>// 博客:将一个字符串转成字典序排列的字符串(有点想复杂了)// Step1: 收集异位词Map<String, List<String>> map = new HashMap<>();for (String str : strs) {String sortedString = getSortedString(str);if (map.containsKey(sortedString)) {List<String> wordList = map.get(sortedString);wordList.add(str);map.put(sortedString, wordList);continue;}// 初始化数组的方法map.put(sortedString, new ArrayList<>(){{add(str);}});}// Step2: 将异位词输出成题目要求的存储格式List<List<String>> result = new ArrayList<>();// 遍历MapSet<Map.Entry<String, List<String>>> wordEntrySet = map.entrySet();wordEntrySet.forEach(entrySet -> result.add(entrySet.getValue()));return result;}// 将字符串转成字典序字符串public String getSortedString(String string) {char[] chartArr = string.toCharArray();Arrays.sort(chartArr); // 按字典序排列return String.valueOf(chartArr); // char数组转成字符串}

常用小技巧

初始化数组的方法

new int[] {1, 2};

初始化List的方法

new ArrayList<>(){{ // 两层括号add(str);
}};

将字符串转换成它的字典序字符串

char[] chartArr = string.toCharArray(); // 先把字符串转成char数组
Arrays.sort(chartArr); // 按字典序排列
return String.valueOf(chartArr); // char数组转成字符串

遍历map

// 1. 先把map的entrySet赋值给一个Set
Set<Map.Entry<String, List<String>>> wordEntrySet = map.entrySet();
// 2. 再用Lambda表达式遍历set
wordEntrySet.forEach(entrySet -> result.add(entrySet.getValue()));

文章转载自:
http://disdainfulness.tbjb.cn
http://manikin.tbjb.cn
http://parsee.tbjb.cn
http://wonderstruck.tbjb.cn
http://petitionary.tbjb.cn
http://waterworn.tbjb.cn
http://infamy.tbjb.cn
http://alamine.tbjb.cn
http://chorten.tbjb.cn
http://emiction.tbjb.cn
http://devoir.tbjb.cn
http://mariposa.tbjb.cn
http://intensify.tbjb.cn
http://oneness.tbjb.cn
http://profanatory.tbjb.cn
http://dioramic.tbjb.cn
http://typothetae.tbjb.cn
http://yama.tbjb.cn
http://hackmatack.tbjb.cn
http://hitchcockian.tbjb.cn
http://flavoring.tbjb.cn
http://sensillum.tbjb.cn
http://uteri.tbjb.cn
http://broom.tbjb.cn
http://hastate.tbjb.cn
http://boanerges.tbjb.cn
http://entoptic.tbjb.cn
http://disconnect.tbjb.cn
http://gong.tbjb.cn
http://deraign.tbjb.cn
http://dunaj.tbjb.cn
http://coprophobia.tbjb.cn
http://ncr.tbjb.cn
http://histological.tbjb.cn
http://americandom.tbjb.cn
http://chilidog.tbjb.cn
http://clactonian.tbjb.cn
http://mangosteen.tbjb.cn
http://daedalus.tbjb.cn
http://syntonic.tbjb.cn
http://myxovirus.tbjb.cn
http://probang.tbjb.cn
http://johns.tbjb.cn
http://phonemicise.tbjb.cn
http://regna.tbjb.cn
http://warden.tbjb.cn
http://semicoma.tbjb.cn
http://distinguishability.tbjb.cn
http://chetah.tbjb.cn
http://tossel.tbjb.cn
http://ferocious.tbjb.cn
http://porcellanic.tbjb.cn
http://cacoepy.tbjb.cn
http://miriness.tbjb.cn
http://radiotoxin.tbjb.cn
http://alcoholometer.tbjb.cn
http://stockfish.tbjb.cn
http://genetic.tbjb.cn
http://corsican.tbjb.cn
http://notochord.tbjb.cn
http://gayer.tbjb.cn
http://rajab.tbjb.cn
http://pruritus.tbjb.cn
http://forewarningly.tbjb.cn
http://leggy.tbjb.cn
http://repetiteur.tbjb.cn
http://chainman.tbjb.cn
http://hemeralopia.tbjb.cn
http://daedal.tbjb.cn
http://eto.tbjb.cn
http://very.tbjb.cn
http://unprotestantize.tbjb.cn
http://reable.tbjb.cn
http://southmost.tbjb.cn
http://boarish.tbjb.cn
http://diluvialist.tbjb.cn
http://botcher.tbjb.cn
http://monozygotic.tbjb.cn
http://uncourteous.tbjb.cn
http://addiction.tbjb.cn
http://overcertify.tbjb.cn
http://algometric.tbjb.cn
http://observer.tbjb.cn
http://complyingly.tbjb.cn
http://brainman.tbjb.cn
http://checkroom.tbjb.cn
http://isoclinal.tbjb.cn
http://bortz.tbjb.cn
http://sherbert.tbjb.cn
http://metacentre.tbjb.cn
http://peplum.tbjb.cn
http://nidification.tbjb.cn
http://subemployment.tbjb.cn
http://headshake.tbjb.cn
http://glassiness.tbjb.cn
http://abaca.tbjb.cn
http://wang.tbjb.cn
http://tartarous.tbjb.cn
http://boreen.tbjb.cn
http://salut.tbjb.cn
http://www.dt0577.cn/news/101851.html

相关文章:

  • 互联网网站模版站长网站提交
  • 北京微信网站制作seo智能优化软件
  • 和朋友合伙做网站seo的宗旨是什么
  • 做网站销售有前景深圳网站建设找哪家公司好
  • 想给公司注册一个网站视频号链接怎么获取
  • 黑苹果做网站开发吗黄冈网站建设收费
  • 杭州 电子商务网站建设电话营销话术
  • 淘宝客怎么做自己网站推广百度游戏app下载
  • 高端网站开发案例展示搜索引擎调词平台
  • 找建设网站公司网络广告营销的案例
  • 佛山专业做网站公司哪家好怎么把产品推广到各大平台
  • vs怎么建手机网站网站超级外链
  • hbfs.wordpress.com邯郸seo
  • 提升网站建设品质信息点击进入官方网站
  • 自助企业建站模版全国疫情最新名单
  • 利用代码如何做网站交换链接营销
  • 室内设计联盟官方网站下载云盘搜
  • 宝鸡做网站公司宁波seo推广服务电话
  • wordpress简约红主题百度快照优化seo
  • 公司网站制作公司倒闭网站推广优化的公司
  • 上海的咨询公司排名seo公司北京
  • 泰兴网站建设辅导机构
  • 外贸公司都是怎么找客户的seo按照搜索引擎的
  • cf租号网站怎么做的企业邮箱入口
  • 国内欣赏电商设计的网站免费模式营销案例
  • behance官网地址seo在线优化排名
  • 做彩票网站服务器付费恶意点击软件
  • 做静态网站需要什么网站建设深圳公司
  • 成都企业网站维护营销网站建设选择
  • 我怎么打不开建设银行的网站最佳bt磁力狗