题目:Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2...
分类:
其他好文 时间:
2014-07-10 14:29:45
阅读次数:
259
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.方法一:最先想到的就是递归,注...
分类:
其他好文 时间:
2014-07-10 09:58:40
阅读次数:
224
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.方法:在inorder中寻找...
分类:
其他好文 时间:
2014-07-07 23:18:53
阅读次数:
283
逻辑简单,代码难写,基础不劳,leecode写注释不能出现中文,太麻烦,我写了大量注释,链表问题最重要的就是你那个指针式干啥的提交地址https://oj.leetcode.com/problems/insertion-sort-list//** * Definition for singly-li...
分类:
编程语言 时间:
2014-07-07 16:59:54
阅读次数:
193
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.For example,Given 1->2-...
分类:
其他好文 时间:
2014-07-07 16:17:00
阅读次数:
139
以前写过c++版本的,感觉java写的好舒心啊/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * Tree...
分类:
编程语言 时间:
2014-07-07 15:27:55
阅读次数:
196
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?
分类:
其他好文 时间:
2014-07-07 13:07:00
阅读次数:
153
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?
分类:
其他好文 时间:
2014-07-03 11:51:05
阅读次数:
117
写完才知道自己学习都是似是而非啊,大家可以也在leecode上提交代码,纯手写,离开eclipse第一种方式:数据结构书上的,使用栈大概思路。1.不断将根节点的左孩子的左孩子直到为空,在这个过程入栈。2.因为栈顶的节点的左孩子为空,所以栈顶的的节点的左子树肯定访问完毕,所以出栈后直接指向右孩子。其实...
分类:
编程语言 时间:
2014-06-30 11:44:30
阅读次数:
193
以前觉得后续遍历最难写,今天看了篇博客http://blog.csdn.net/sgbfblog/article/details/7773103,其实却是我们仔细比较后续遍历和先序遍历,其实后续遍历就是按照 根右左 的方式先序访问然后逆序就是答案了,会先序就会逆序了leecode 的AC代码:pub...
分类:
编程语言 时间:
2014-06-30 11:32:15
阅读次数:
206