摘要: class Solution { /** * 计算给定数组中的最长连续序列长度 * 存在逻辑缺陷的初始实现(需结合注释理解问题) * @param nums 未排序的整数数组(可能包含重复元素) * @return 最长连续序列的长度 */ public int longestConsecutive 阅读全文
posted @ 2025-05-20 19:13 星星永远发着光 阅读(9) 评论(0) 推荐(0)
摘要: class Solution { public List<List<String>> groupAnagrams(String[] strs) { // 创建哈希表,键为排序后的特征字符串,值为对应的异位词分组 Map<String, List<String>> map = new HashMap< 阅读全文
posted @ 2025-05-20 17:47 星星永远发着光 阅读(11) 评论(0) 推荐(0)