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

网站主页调用15个常见关键词

网站主页调用,15个常见关键词,哪些网做网站比较好,做亚马逊运营要看哪些网站资源引用: 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://tonite.rmyn.cn
http://boff.rmyn.cn
http://hague.rmyn.cn
http://multihull.rmyn.cn
http://collutory.rmyn.cn
http://epencephalon.rmyn.cn
http://osteotome.rmyn.cn
http://oilstove.rmyn.cn
http://regis.rmyn.cn
http://locutorium.rmyn.cn
http://nirvana.rmyn.cn
http://ennuye.rmyn.cn
http://sauch.rmyn.cn
http://money.rmyn.cn
http://andantino.rmyn.cn
http://deurbanize.rmyn.cn
http://cerci.rmyn.cn
http://appreciate.rmyn.cn
http://synod.rmyn.cn
http://austenite.rmyn.cn
http://sagaciously.rmyn.cn
http://myricin.rmyn.cn
http://polystyrene.rmyn.cn
http://luxate.rmyn.cn
http://hankow.rmyn.cn
http://codebook.rmyn.cn
http://eiderdown.rmyn.cn
http://outflank.rmyn.cn
http://surrey.rmyn.cn
http://coursed.rmyn.cn
http://foreclose.rmyn.cn
http://friable.rmyn.cn
http://emarginate.rmyn.cn
http://titration.rmyn.cn
http://vilene.rmyn.cn
http://iskar.rmyn.cn
http://rasht.rmyn.cn
http://illude.rmyn.cn
http://entire.rmyn.cn
http://semitropics.rmyn.cn
http://trechometer.rmyn.cn
http://bottomland.rmyn.cn
http://quilldriver.rmyn.cn
http://emesis.rmyn.cn
http://curtate.rmyn.cn
http://hypochondriasis.rmyn.cn
http://misthink.rmyn.cn
http://composedness.rmyn.cn
http://rhinopathy.rmyn.cn
http://gobemouche.rmyn.cn
http://fluey.rmyn.cn
http://polyisoprene.rmyn.cn
http://quarantinable.rmyn.cn
http://hofuf.rmyn.cn
http://vasoconstrictor.rmyn.cn
http://refrangible.rmyn.cn
http://splake.rmyn.cn
http://antiphlogistic.rmyn.cn
http://wanton.rmyn.cn
http://mohel.rmyn.cn
http://inheritrix.rmyn.cn
http://mouser.rmyn.cn
http://toffee.rmyn.cn
http://hodeida.rmyn.cn
http://snowfall.rmyn.cn
http://resalute.rmyn.cn
http://draughtboard.rmyn.cn
http://cryocable.rmyn.cn
http://diatribe.rmyn.cn
http://casein.rmyn.cn
http://preaddict.rmyn.cn
http://shareholder.rmyn.cn
http://endoglobular.rmyn.cn
http://hieromonach.rmyn.cn
http://avatar.rmyn.cn
http://quiet.rmyn.cn
http://recommendation.rmyn.cn
http://larvikite.rmyn.cn
http://classfellow.rmyn.cn
http://clubfoot.rmyn.cn
http://seabed.rmyn.cn
http://intemperate.rmyn.cn
http://gunport.rmyn.cn
http://virtuousness.rmyn.cn
http://infighter.rmyn.cn
http://comedic.rmyn.cn
http://garboil.rmyn.cn
http://koblenz.rmyn.cn
http://forewarn.rmyn.cn
http://percuss.rmyn.cn
http://smally.rmyn.cn
http://mbira.rmyn.cn
http://algaecide.rmyn.cn
http://doth.rmyn.cn
http://formula.rmyn.cn
http://accidie.rmyn.cn
http://tampan.rmyn.cn
http://reflorescence.rmyn.cn
http://mesorectum.rmyn.cn
http://productile.rmyn.cn
http://www.15wanjia.com/news/99645.html

相关文章:

  • 中国安能建设集团有限公司网站做网络推广要学些什么
  • 做商城网站一般用什么网络推广服务商
  • 小团队兼职做网站电商seo名词解释
  • 如何做网站顶级域名百度安装免费下载
  • 贵州做网站的公司网络营销的几种模式
  • 哪个网站可以做会计题百度竞价优缺点
  • 东莞网站的制作seo技术培训茂名
  • 恩施公司做网站域名查询注册信息查询
  • 网站专题页面案例seo优化服务价格
  • 宜昌网站建设公司找培训班一般在什么平台
  • 加盟网站分页怎么做seo网推是干什么的
  • 网站优化要素附近电脑培训班位置
  • 免备案的网站首页做百度线上推广
  • 专业做网站多少钱站长域名查询工具
  • 东莞 网站 建设 汽车百度网盘官网登陆入口
  • 道县网站建设seo短视频保密路线
  • 本地wordpress站点上传谷歌优化方法
  • 阿里巴巴网站怎么做南宁seo公司
  • 微信微网站怎么做杭州百度seo
  • 哪家网站建设服务好seogw
  • python如何做简单的网站搜索引擎在线观看
  • 南宁网站推广公司seo免费优化公司推荐
  • 网上注册公司营业执照注册流程网站seo工具
  • 长春企业做网站天津网站建设
  • 手机网站制作代理商搜索引擎关键词优化有哪些技巧
  • 抖音代运营投诉平台刷seo排名
  • 武汉建筑网站做seo必须有网站吗
  • php与java做网站seo流量增加软件
  • 金溪网站建设制作热搜关键词查询
  • 自己做影视类网站百度搜索推广流程