摘要: public class Solution { public List topKFrequent(int[] nums, int k) { //1. 遍历独立的元素并计数 Map map = new HashMap(); for(int i = 0; i > queue = new PriorityQueue>( ... 阅读全文
posted @ 2019-03-13 15:03 notesbuddy 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2017-04-25 13:04 notesbuddy 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. Note: You may assum 阅读全文
posted @ 2017-04-19 11:39 notesbuddy 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 本月一些事情,没法更新,要到下个月或者下个月底才能继续。 不要找理由!!!!!! 阅读全文
posted @ 2017-04-15 16:36 notesbuddy 阅读(96) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2- 阅读全文
posted @ 2017-03-19 23:54 notesbuddy 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Reverse a singly linked list. 阅读全文
posted @ 2017-03-19 22:41 notesbuddy 阅读(112) 评论(0) 推荐(0) 编辑
摘要: Partition List Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You shoul 阅读全文
posted @ 2017-03-19 21:37 notesbuddy 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Restore IP Addresses Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "255 阅读全文
posted @ 2017-03-17 00:33 notesbuddy 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the 阅读全文
posted @ 2017-03-07 20:32 notesbuddy 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1->1-> 阅读全文
posted @ 2017-03-04 17:44 notesbuddy 阅读(119) 评论(0) 推荐(0) 编辑