上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 21 下一页
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example, Given: s1 = "aabcc", s2 = "dbbca",When s3 = "aadbbcbcac", re... Read More
posted @ 2014-08-06 20:39 Xylophone Views(120) Comments(0) Diggs(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 n... Read More
posted @ 2014-08-06 11:04 Xylophone Views(106) Comments(0) Diggs(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 is... Read More
posted @ 2014-08-06 10:39 Xylophone Views(172) Comments(0) Diggs(0)
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given "25525511135",return ["25... Read More
posted @ 2014-08-05 17:30 Xylophone Views(159) Comments(0) Diggs(0)
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i... Read More
posted @ 2014-08-05 15:36 Xylophone Views(124) Comments(0) Diggs(0)
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)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 21 下一页