Follow up for "Remove Duplicates": What if duplicates are allowed at most twice?For example, Given sorted array A = [1,1,1,2,2,3],Your function should... Read More
posted @ 2014-08-04 22:40
Xylophone
Views(147)
Comments(0)
Diggs(0)
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ... Read More
posted @ 2014-08-04 22:00
Xylophone
Views(179)
Comments(0)
Diggs(0)
Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree./** * Definiti... Read More
posted @ 2014-08-04 21:11
Xylophone
Views(147)
Comments(0)
Diggs(0)
Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.class Solutio... Read More
posted @ 2014-08-04 20:58
Xylophone
Views(160)
Comments(0)
Diggs(0)
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.方法:为了使BST高度平衡,要找链表中的中值作为当前根节点。/** * Defin... Read More
posted @ 2014-08-04 16:59
Xylophone
Views(164)
Comments(0)
Diggs(0)
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... Read More
posted @ 2014-08-04 16:21
Xylophone
Views(230)
Comments(0)
Diggs(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 and su... Read More
posted @ 2014-08-04 15:45
Xylophone
Views(128)
Comments(0)
Diggs(0)
Given a binary tree, flatten it to a linked list in-place.For example, Given 1 / \ 2 5 / \ \ 3 4 6The flattened ... Read More
posted @ 2014-08-04 15:04
Xylophone
Views(155)
Comments(0)
Diggs(0)
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from th... Read More
posted @ 2014-08-04 11:38
Xylophone
Views(212)
Comments(0)
Diggs(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 stil... Read More
posted @ 2014-08-04 10:29
Xylophone
Views(128)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号