摘要: 分析: 先用hash表存数字和次数,然后使用最小堆遍历哈希表,堆的大小为k,时间复杂度为 O(n) = n log k 代码: 点击查看代码 class Solution { public int[] topKFrequent(int[] nums, int k) { Map<Integer,Int 阅读全文
posted @ 2025-08-30 11:24 柳成荫y 阅读(7) 评论(0) 推荐(0)