随笔分类 - LeetCode
摘要:6354. 找出数组的串联值 题意 将数组首尾元素接在一起,就是串联值。 串联之后删除,如果只剩下一个元素,加上这个元素即可 双指针,从首和尾向中间移动即可 code **注意:**用 long 没看题目用了 int wa了一发 class Solution { public long findTh
阅读全文
摘要:2558. 从数量最多的堆取走礼物 题意 给一组数字,每秒都选择最大的一个,留下其平方根 用 最大堆就行 code class Solution { public long pickGifts(int[] g, int k) { long ans = 0; PriorityQueue<Integer
阅读全文
摘要:2544. 交替数字和 代码1 转成字符串,逐个判断 class Solution { public int alternateDigitSum(int n) { char[] s = ("" + n).toCharArray(); int t = 1; int ans = 0; for (int
阅读全文
摘要:LeetCode_单周赛_327
Java
阅读全文