摘要: 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 deep copy 阅读全文
posted @ 2017-06-14 16:19 王大咩的图书馆 阅读(239) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given1->2- 阅读全文
posted @ 2017-06-14 14:50 王大咩的图书馆 阅读(273) 评论(0) 推荐(0) 编辑
摘要: Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given1->1->2, return1->2.Given1->1->2->3->3, re 阅读全文
posted @ 2017-06-14 09:39 王大咩的图书馆 阅读(211) 评论(0) 推荐(0) 编辑
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 题意:合并两个排 阅读全文
posted @ 2017-06-14 09:18 王大咩的图书馆 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n ) space 阅读全文
posted @ 2017-06-13 21:39 王大咩的图书馆 阅读(299) 评论(0) 推荐(0) 编辑
摘要: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should return all 阅读全文
posted @ 2017-06-13 20:25 王大咩的图书馆 阅读(354) 评论(0) 推荐(0) 编辑
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST' 阅读全文
posted @ 2017-06-13 17:12 王大咩的图书馆 阅读(2795) 评论(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 only 阅读全文
posted @ 2017-06-13 15:53 王大咩的图书馆 阅读(361) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept 阅读全文
posted @ 2017-06-13 10:46 王大咩的图书馆 阅读(353) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文
posted @ 2017-06-12 22:18 王大咩的图书馆 阅读(379) 评论(0) 推荐(0) 编辑
摘要: Follow up for problem "Populating Next Right Pointers in Each Node". What if the given tree could be any binary tree? Would your previous solution sti 阅读全文
posted @ 2017-06-11 15:57 王大咩的图书馆 阅读(353) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set toNULL. 阅读全文
posted @ 2017-06-11 10:54 王大咩的图书馆 阅读(337) 评论(0) 推荐(0) 编辑
摘要: Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2017-06-11 09:43 王大咩的图书馆 阅读(411) 评论(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 @ 2017-06-10 22:40 王大咩的图书馆 阅读(355) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文
posted @ 2017-06-10 21:24 王大咩的图书馆 阅读(366) 评论(0) 推荐(0) 编辑