uacs2024

导航

2025年12月2日 #

leetcode49. 字母异位词分组

摘要: 49. 字母异位词分组 法一:每个字符串先排序,再加入到HashMap。自己写的。 class Solution { public List<List<String>> groupAnagrams(String[] strs) { int n = strs.length; HashMap<Strin 阅读全文

posted @ 2025-12-02 19:29 ᶜʸᵃⁿ 阅读(7) 评论(0) 推荐(0)

leetcode134. 加油站

摘要: 134. 加油站 法一:先计算 rest[i] = gas[i] - cost[i] , 判断从某个位置开始的累和是否<0。时间打败了5.17%🤡 class Solution { public int canCompleteCircuit(int[] gas, int[] cost) { int 阅读全文

posted @ 2025-12-02 17:11 ᶜʸᵃⁿ 阅读(9) 评论(0) 推荐(0)