Maximum Subarray Given an array of integers, find a contiguous subarray which has the largest sum. Given the array [?2,2,?3,4,?1,2,1,?5,3], the contig ...
分类:
其他好文 时间:
2017-10-20 12:01:41
阅读次数:
114
二叉查找树在数据结构中学习,但是感觉自己学的非常水,最近在lintCode上做了两道的关于二叉查找树的题,感觉有比较记录下来,就当是增强记忆! 1.二叉查找树I 题意: 样例: 这个是数据结构中的二叉树中非常的常见。这个是典型卡特兰数的样例 (1).卡特兰数 令h(0)=1,h(1)=1,卡特兰数满 ...
分类:
编程语言 时间:
2017-10-20 10:22:29
阅读次数:
230
题目链接 http://www.lintcode.com/zh-cn/problem/add-digits/ 题目大意 给出一个非负整数 num,反复的将所有位上的数字相加,直到得到一个一位的整数。 样例 给出 num = 38。 相加的过程如下:3 + 8 = 11,1 + 1 = 2。因为 2 ...
分类:
其他好文 时间:
2017-10-18 15:27:22
阅读次数:
115
1,问题描述 A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a de ...
分类:
其他好文 时间:
2017-10-18 00:24:37
阅读次数:
122
Half and Half 类型题 二分法的精髓在于判断目标值在前半区间还是后半区间,Half and Half类型难点在不能一次判断,可能需要一次以上的判断条件。 Maximum Number in Mountain Sequence Given a mountain sequence of n ...
分类:
其他好文 时间:
2017-10-16 09:51:34
阅读次数:
166
比较两个字符串A和B,确定A中是否包含B中所有的字符。字符串A和B中的字符都是 大写字母 注意事项 在 A 中出现的 B 字符串里的字符不需要连续或者有序。 样例 给出 A = "ABCD" B = "ACD",返回 true 给出 A = "ABCD" B = "AABC", 返回 false 思 ...
分类:
其他好文 时间:
2017-10-13 21:26:06
阅读次数:
206
Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the ...
分类:
其他好文 时间:
2017-10-13 14:07:16
阅读次数:
136
Sort a linked list using insertion sort. Sort a linked list using insertion sort. Sort a linked list using insertion sort. Example Given 1->3->2->0->n ...
分类:
其他好文 时间:
2017-10-13 14:06:23
阅读次数:
154
Given a linked list, determine if it has a cycle in it. Given a linked list, determine if it has a cycle in it. Given a linked list, determine if it h ...
分类:
其他好文 时间:
2017-10-13 14:02:28
阅读次数:
146
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 should preserve the ...
分类:
其他好文 时间:
2017-10-13 13:55:27
阅读次数:
122