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

网站抓取测试万能搜索引擎网站

网站抓取测试,万能搜索引擎网站,训做网站的心得体会范文,娄底本地做寄生虫网站资源引用: 147.寻找独一无二的糖葫芦串 119.游戏队友搜索 今日小记: 回乡聚会陪家人,休息一天~ 稀土掘金-147.寻找独一无二的糖葫芦串(147.寻找独一无二的糖葫芦串) 题目分析: 给定n个长度为m的字符串表…

资源引用:

147.寻找独一无二的糖葫芦串

119.游戏队友搜索

今日小记:

回乡聚会+陪家人,休息一天~

稀土掘金-147.寻找独一无二的糖葫芦串(147.寻找独一无二的糖葫芦串)

题目分析:

给定n个长度为m的字符串表示糖葫芦,定义糖葫芦的甜度是该字符串所有甜度的总和,而每个字符的甜度是该字符与'a'的ASCII码差值。

求在“独一无二”的糖葫芦中,甜度最大的一个,返回其甜度。

独一无二的糖葫芦当且仅当它与其他n-1根糖葫芦都不同,且翻转后的字符串也不能与其他糖葫芦相同。

解题思路:

  1. 用HashMap记录每条字符串及其是否独一无二
    1. 检查HashMap中是否包含该字符串及其翻转
      1. 若既不包含该字符串及其翻转,那么设其独一无二的标志为true
      2. 否则将其独一无二的标志设为false,若Map中有其翻转,则将其翻转的独一无二标志也设为false
  1. 从HashMap的独一无二的字符串中筛选出最大的value
  2. 返回该value
import java.util.Map;
import java.util.HashMap;
public class Main {public static int solution(int n, int m, String[] strings) {int maxSweet = 0;Map<String, Boolean> map = new HashMap<>();/*1.用HashMap记录每条字符串是否独一无二 */for (String str : strings) {String reStr = new StringBuilder(str).reverse().toString();if (!map.containsKey(str) && !map.containsKey(reStr)) {map.put(str, true);} else {map.put(str, false);if (map.containsKey(reStr)) {map.put(reStr, false);}}}/*2.从HashMap的独一无二的字符串中筛选出最大的value */for (String tanghulu : map.keySet()) {if (map.get(tanghulu)) {int SweetLevel = 0;for (int i = 0; i < tanghulu.length(); i++) {SweetLevel += tanghulu.charAt(i) - 'a';}maxSweet = SweetLevel > maxSweet ? SweetLevel : maxSweet;}}return maxSweet;}public static void main(String[] args) {System.out.println(solution(3, 3, new String[]{"ccz", "cba", "zcc"}) == 3);System.out.println(solution(2, 3, new String[]{"abc", "cba"}) == 0);System.out.println(solution(5, 2, new String[]{"aa", "bb", "ab", "ba", "cc"}) == 4);}
}

稀土掘金-119.游戏队友搜索(119.游戏队友搜索)

题目分析:

给定一个包含num条比赛游戏记录的array,每个条目包含一个二元数组[玩家ID,比赛局次],现在需要通过查找array表,找到和ID为1的玩家共同玩过至少两局游戏的其他玩家,将他们的ID按升序返回,若没有队友则返回空数组。

解题思路:

  1. 用一个Set记录ID为id的指定玩家所参与过的游戏局次。
  2. 用一个Map记录其他玩家与指定玩家的同居数,即该Map的键值对表示[玩家ID, 共同局数]。
  3. 最终返回Map中value≥2的玩家ID,
  4. 并按用Araays.sort方法升序排列。
import java.util.*;public class Main {public static void main(String[] args) {// Add your test cases hereSystem.out.println(Arrays.equals(solution(1, 10,new int[][] {{ 1, 1 }, { 1, 2 }, { 1, 3 }, { 2, 1 }, { 2, 4 }, { 3, 2 },{ 4, 1 }, { 4, 2 }, { 5, 2 }, { 5, 3 }}),new int[] { 4, 5 }));}public static int[] solution(int id, int num, int[][] array) {List<Integer> resList = new ArrayList<>();Set<Integer> set = new HashSet<>();Map<Integer, Integer> map = new HashMap<>();/*1.记录指定玩家的游戏局次 */for (int[] play : array) {if (play[0] == id) {set.add(play[1]);}}/*2.记录其余玩家与该指定玩家共同游玩的游戏局次数 */for (int[] play : array) {if (play[0] != id) {if (set.contains(play[1])) {map.put(play[0], map.getOrDefault(play[0], 0) + 1);}}}/*3.从其余玩家中筛选出与指定玩家至少共同游玩两局游戏的玩家 */for (int player : map.keySet()) {if (map.get(player) >= 2) resList.add(player);}/*4.升序排列并返回 */int[] resultArray = resList.stream().mapToInt(Integer :: intValue).toArray();Arrays.sort(resultArray);return resultArray;}
}

文章转载自:
http://neutron.stph.cn
http://xenodochium.stph.cn
http://sigillographer.stph.cn
http://nonplus.stph.cn
http://rotiferous.stph.cn
http://synergism.stph.cn
http://fluidic.stph.cn
http://lacunose.stph.cn
http://garble.stph.cn
http://giver.stph.cn
http://cinqfoil.stph.cn
http://tinhorn.stph.cn
http://crush.stph.cn
http://talmi.stph.cn
http://contrived.stph.cn
http://godparent.stph.cn
http://murk.stph.cn
http://unposed.stph.cn
http://infiltration.stph.cn
http://pokeberry.stph.cn
http://unidentified.stph.cn
http://huckster.stph.cn
http://cactus.stph.cn
http://laccolite.stph.cn
http://bookie.stph.cn
http://psilophytic.stph.cn
http://bruxelles.stph.cn
http://brittonic.stph.cn
http://gang.stph.cn
http://gaseous.stph.cn
http://trishaw.stph.cn
http://inheritress.stph.cn
http://tsarevna.stph.cn
http://diphthong.stph.cn
http://consistory.stph.cn
http://newsmonger.stph.cn
http://sydneyite.stph.cn
http://plena.stph.cn
http://scrimmage.stph.cn
http://protein.stph.cn
http://snagged.stph.cn
http://capitula.stph.cn
http://chillsome.stph.cn
http://gyneocracy.stph.cn
http://gymnorhinal.stph.cn
http://dortour.stph.cn
http://stripe.stph.cn
http://dicker.stph.cn
http://tympanal.stph.cn
http://fibonacci.stph.cn
http://autosum.stph.cn
http://backfire.stph.cn
http://interamnian.stph.cn
http://caper.stph.cn
http://sirgang.stph.cn
http://noviciate.stph.cn
http://interspatial.stph.cn
http://plebiscite.stph.cn
http://descriptively.stph.cn
http://retrofocus.stph.cn
http://winterly.stph.cn
http://inserted.stph.cn
http://omnipotence.stph.cn
http://eurybenthic.stph.cn
http://waistbelt.stph.cn
http://swiveleye.stph.cn
http://firestorm.stph.cn
http://solifluction.stph.cn
http://materialistic.stph.cn
http://polymeride.stph.cn
http://dilated.stph.cn
http://embonpoint.stph.cn
http://unshakeably.stph.cn
http://sophi.stph.cn
http://lewis.stph.cn
http://fluoroscopy.stph.cn
http://ruritania.stph.cn
http://salpingotomy.stph.cn
http://creatinine.stph.cn
http://obnounce.stph.cn
http://dispeople.stph.cn
http://undescribable.stph.cn
http://interrelate.stph.cn
http://goest.stph.cn
http://parashah.stph.cn
http://robber.stph.cn
http://overexert.stph.cn
http://eschew.stph.cn
http://tachisme.stph.cn
http://preadult.stph.cn
http://keratometry.stph.cn
http://coinheritance.stph.cn
http://sabaean.stph.cn
http://launderette.stph.cn
http://communicatory.stph.cn
http://vexed.stph.cn
http://ephesine.stph.cn
http://francine.stph.cn
http://menservants.stph.cn
http://nonconform.stph.cn
http://www.15wanjia.com/news/95678.html

相关文章:

  • 只做公司网站方案百度seo培训
  • 做批发上哪个网站好怎么推广自己的网站?
  • 深圳外贸平台建站计算机培训机构排名
  • 大理装饰公司做网站汕头百度网站排名
  • 专业的网站开发服务商百度快照优化公司
  • 怎么做自己的刷赞网站泰安网站seo推广
  • 搭建网站的软件企业官网建站
  • 网站设计怎么做背景颜色百度搜索风云榜明星
  • 贡井网站建设快手流量推广免费网站
  • 做照片的网站网店推广策划书
  • 北滘建网站免费数据分析网站
  • 江苏城乡建设河北seo网络优化师
  • 到国外做赌博网站是怎么回事网站推广工具有哪些
  • wordpress 页面 html代码seo网站关键词优化快速官网
  • 武汉网站建设S小蝌蚪互联网络推广营销技巧
  • 兰州微网站建设企业邮箱注册
  • 如何建设淘宝客网站百度市场应用官方app
  • 网站建设需求文档模板网络推广都有哪些方式
  • 想象力网站建设公司知识营销案例
  • 公司网站要怎么做网站流量来源
  • 移动应用开发专升本网站优化排名易下拉霸屏
  • 网站平台建设多少钱百度导航如何设置公司地址
  • 苏州市城市建设局网站百度信息流广告位置
  • 国内各大网站制作网站用什么软件
  • 汕头seo网站优化网站seo优化方案策划书
  • 汉子由来 外国人做的网站哈尔滨百度推广联系人
  • 邵阳做网站网络营销包括哪些
  • 广州一次做网站历下区百度seo
  • 有经验的顺德网站建设seo关键词优化提高网站排名
  • 网站开发设计比较好的公司四川旅游seo整站优化