上一页 1 ··· 9 10 11 12 13 14 下一页
摘要: 问题一: 安排最多的会议 会议包括开始时间和结束时间贪心法:准备一个优先队列(或是一个按结束时间排序的数组),一个时间节点(表示上一个会议结束的时间)初始设置为0遍历如果开始时间大于等于时间节点,则能能安排的会议数+1 public class BestArrange { public static 阅读全文
posted @ 2021-08-31 21:24 sherry001 阅读(90) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the preorder traversal of its nodes' values. Example: Input: [1,null,2,3] 1 \ 2 / 3 Output: [1,2,3] Follow up: Recursive s 阅读全文
posted @ 2021-08-31 21:24 sherry001 阅读(49) 评论(0) 推荐(0) 编辑
摘要: Given the head of a linked list, return the list after sorting it in ascending order. Follow up: Can you sort the linked list in O(n logn) time and O( 阅读全文
posted @ 2021-08-31 21:24 sherry001 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 先来看最多的线段重合数问题,给出一组线段集合,求最大重合线段数 求解过程: 把一个线段生成一个对象 开始位置start 结束位置end 选按开始位置排序 [1,7] [1,4] [1,9] [2,13] [5,10] 再搞一个有序表(按结束位置排序) 用TreeMap,TreeSet,或Priori 阅读全文
posted @ 2021-08-30 18:24 sherry001 阅读(59) 评论(0) 推荐(0) 编辑
摘要: Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two 阅读全文
posted @ 2021-08-30 11:42 sherry001 阅读(48) 评论(0) 推荐(0) 编辑
摘要: Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capacity) Initia 阅读全文
posted @ 2021-08-30 10:50 sherry001 阅读(71) 评论(0) 推荐(0) 编辑
摘要: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: Input: [ 1->4->5, 1->3->4, 2->6 ] Output: 阅读全文
posted @ 2021-08-30 09:43 sherry001 阅读(37) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists. E 阅读全文
posted @ 2021-08-29 17:22 sherry001 阅读(42) 评论(0) 推荐(0) 编辑
摘要: Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the 阅读全文
posted @ 2021-08-29 16:09 sherry001 阅读(32) 评论(0) 推荐(0) 编辑
摘要: Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well. Example 阅读全文
posted @ 2021-08-29 16:06 sherry001 阅读(60) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 下一页