题目: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Note: If the ...
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh ...
分类:
其他好文 时间:
2018-05-25 17:52:26
阅读次数:
109
Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Examp ...
分类:
其他好文 时间:
2018-05-23 13:07:29
阅读次数:
303
题目要求time complexity 是O(log (m+n)), 先归并排序也是不可行的, 时间复杂度为O(m+n) ...
分类:
其他好文 时间:
2018-05-21 10:29:28
阅读次数:
159
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 合并k个有序链表。 用归并排序就好了。 ...
分类:
其他好文 时间:
2018-05-20 16:42:50
阅读次数:
173
中英题面 合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 示例: 输入: [ ...
分类:
编程语言 时间:
2018-05-20 10:53:36
阅读次数:
191
中英题面 在 O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序。 Sort a linked list in O(n log n) time using constant space complexity. 示例 1: 输入: 4->2->1->3 输出: 1->2->3->4 ...
分类:
编程语言 时间:
2018-05-20 10:40:58
阅读次数:
226
1、复杂度:complexity,就是操作的数量。 我所能想到的大O符号最好的例子就是做算术。拿两个数字(123456和789012)举例。让我们假设在算法中,加上这些数是计算开销最大的操作。合乎情理的说,为了把这两个数加起来我们必须要加6次数字(并且可能进位到第7次)。如果我们把两个100位数相加 ...
分类:
数据库 时间:
2018-05-18 18:12:11
阅读次数:
160
Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5->3->4-> ...
分类:
其他好文 时间:
2018-05-11 20:39:26
阅读次数:
154
DDD领域驱动设计基本理论知识总结 原文:DDD领域驱动设计基本理论知识总结 领域驱动设计之领域模型 加一个导航,关于如何设计聚合的详细思考,见这篇文章。 2004年Eric Evans 发表Domain-Driven Design –Tackling Complexity in the Heart ...
分类:
其他好文 时间:
2018-05-07 19:48:13
阅读次数:
151