Remove Node in Binary Search TreeGiven a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no ...
分类:
其他好文 时间:
2015-07-09 22:39:36
阅读次数:
156
中等 复制带随机指针的链表
查看运行结果
27%
通过
给出一个链表,每个节点包含一个额外增加的随机指针可以指向链表中的任何节点或空的节点。
返回一个深拷贝的链表。
用了一个哈希表,空间换取时间
/**
* Definition for singly-linked list with a random pointer.
* ...
分类:
其他好文 时间:
2015-07-09 14:40:58
阅读次数:
131
题目描述
链接地址
解法题目描述Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. ExampleGiven 1->2->3->3->4->4->5, return 1->2->5.
Given...
分类:
其他好文 时间:
2015-07-09 00:56:36
阅读次数:
127
题目描述
链接地址
解法题目描述Given a sorted linked list, delete all duplicates such that each element appear only once.Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.链接地址http://www.lintcode.com/en...
分类:
其他好文 时间:
2015-07-08 09:36:06
阅读次数:
109
1 /** 2 * Definition of ListNode 3 * class ListNode { 4 * public: 5 * int val; 6 * ListNode *next; 7 * ListNode(int val) { 8 * ...
分类:
其他好文 时间:
2015-07-07 22:34:59
阅读次数:
203
1 /** 2 * Definition of ListNode 3 * class ListNode { 4 * public: 5 * int val; 6 * ListNode *next; 7 * ListNode(int val) { 8 * ...
分类:
其他好文 时间:
2015-07-07 21:08:38
阅读次数:
104
递归实现:class Solution {public: /** * @param nums: A list of integers. * @return: A list of permutations. */ vector > permute(vector nu...
分类:
其他好文 时间:
2015-07-07 02:03:20
阅读次数:
194
递归实现: 1 class Solution { 2 public: 3 /** 4 * @param nums: A list of integers. 5 * @return: A list of unique permutations. 6 */ 7 ...
分类:
其他好文 时间:
2015-07-07 02:02:48
阅读次数:
390
题目描述
链接地址
解法题目描述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 original relative order of the nodes...
分类:
其他好文 时间:
2015-07-07 00:55:14
阅读次数:
116
http://www.lintcode.com/en/problem/wood-cut/#
二分答案,贪心验证,具有单调性
class Solution {
public:
/**
*@param L: Given n pieces of wood with length L[i]
*@param k: An integer
*return...
分类:
其他好文 时间:
2015-07-06 23:30:25
阅读次数:
233