摘要: 题目: Reverse a linked list. Example For linked list 1->2->3, the reversed linked list is 3->2->1 For linked list 1->2->3, the reversed linked list is 3 阅读全文
posted @ 2017-05-10 22:30 Vincent丶丶 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Example Given 1->2 阅读全文
posted @ 2017-05-10 21:56 Vincent丶丶 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted linked list, delete all duplicates such that each element appear only once. Example Given 1->1->2, return 1->2.Given 1->1->2->3->3, 阅读全文
posted @ 2017-05-10 21:22 Vincent丶丶 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no such a node with given value 阅读全文
posted @ 2017-05-10 20:11 Vincent丶丶 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 题目: Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Find all the keys of tree in range k1 to k2. i.e. print all 阅读全文
posted @ 2017-05-10 11:21 Vincent丶丶 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2017-05-10 11:06 Vincent丶丶 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). Example Given binary tree {3 阅读全文
posted @ 2017-05-09 22:18 Vincent丶丶 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目: Given the root and two nodes in a Binary Tree. Find the lowest common ancestor(LCA) of the two nodes. The lowest common ancestor is the node with 阅读全文
posted @ 2017-05-09 21:35 Vincent丶丶 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Example Given the below binary tree: 1 / \ 2 3 阅读全文
posted @ 2017-05-09 20:58 Vincent丶丶 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 模板: 1.先序遍历三种方法 1)迭代: 2)递归: 3)分治: 模板2:DFS: 1) Traverse 2) Divide and Conquer 栈实现非递归DFS 阅读全文
posted @ 2017-05-08 20:03 Vincent丶丶 阅读(212) 评论(0) 推荐(0) 编辑