02 2015 档案

摘要:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2015-02-28 10:11 胡潇 阅读(183) 评论(0) 推荐(0)
摘要:1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(... 阅读全文
posted @ 2015-02-26 05:06 胡潇 阅读(149) 评论(0) 推荐(0)
摘要:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret... 阅读全文
posted @ 2015-02-25 09:00 胡潇 阅读(164) 评论(0) 推荐(0)
摘要:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2015-02-24 03:13 胡潇 阅读(171) 评论(0) 推荐(0)
摘要:RT 阅读全文
posted @ 2015-02-17 06:27 胡潇 阅读(124) 评论(0) 推荐(0)
摘要:题目:Reverse a singly linked list.解题:反转单链表,不再多介绍了.如果会“先条件->定参数->确定不变式->验证后条件”的思维方法,一定会bug free. 1 /** 2 * Definition for singly-linked list. 3 * struc... 阅读全文
posted @ 2015-02-14 06:30 胡潇 阅读(190) 评论(0) 推荐(0)
摘要:rt 阅读全文
posted @ 2015-02-13 07:52 胡潇 阅读(159) 评论(0) 推荐(0)
摘要:rt 阅读全文
posted @ 2015-02-12 07:10 胡潇 阅读(153) 评论(0) 推荐(0)
摘要:未完成,还可以找到更好的解 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x)... 阅读全文
posted @ 2015-02-11 22:30 胡潇 阅读(164) 评论(0) 推荐(0)
摘要:A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its index.... 阅读全文
posted @ 2015-02-10 23:23 胡潇 阅读(269) 评论(0) 推荐(0)
摘要:Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.... 阅读全文
posted @ 2015-02-10 08:22 胡潇 阅读(190) 评论(0) 推荐(0)
摘要:Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not co... 阅读全文
posted @ 2015-02-06 06:11 胡潇 阅读(141) 评论(0) 推荐(0)
摘要:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =... 阅读全文
posted @ 2015-02-05 23:48 胡潇 阅读(162) 评论(0) 推荐(0)
摘要:Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni... 阅读全文
posted @ 2015-02-05 08:38 胡潇 阅读(206) 评论(0) 推荐(0)
摘要:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2015-02-04 22:33 胡潇 阅读(151) 评论(0) 推荐(0)
摘要:2.4 证明对任意常数k,(称此式为公式A)证明:①当k11)时,都满足公式A,即 (k1),若能证明,即可得证公式A成立, 根据洛比达法则,0/0型不定式极限和∞/∞型不定式极限,有: 因此对内部分数上下求导,得: ... 阅读全文
posted @ 2015-02-03 00:05 胡潇 阅读(178) 评论(0) 推荐(0)