上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 24 下一页
摘要: Given inorder and postorder traversal of a tree, construct the binary tree.题目大意:给定一个二叉树的中序和后续序列,构建出这个二叉树。解题思路:首先后序序列的最后一个是根节点,然后在中序序列中找到这个节点,中序序列中这个节点... 阅读全文
posted @ 2015-04-21 15:26 丶Blank 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题目大意:给定一个升序序列的数组,将其转换为二叉搜索树。解题思路:数组中间元素是根元素,根元素将数组划分为... 阅读全文
posted @ 2015-04-20 21:28 丶Blank 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a list of non negative integers, arrange them such that they form the largest number.For example, given[3, 30, 34, 5, 9], the largest formed num... 阅读全文
posted @ 2015-04-20 19:36 丶Blank 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Given a range [m, n] where 0 offset = new HashSet(); for (int i = 0; i >=1; n>>=1; offset++; } return m<<o... 阅读全文
posted @ 2015-04-20 17:42 丶Blank 阅读(1354) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in... 阅读全文
posted @ 2015-04-20 16:43 丶Blank 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文
posted @ 2015-04-20 16:36 丶Blank 阅读(171) 评论(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 @ 2015-04-13 21:11 丶Blank 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2015-04-13 20:36 丶Blank 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-04-13 20:13 丶Blank 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callingnext()will return the next... 阅读全文
posted @ 2015-04-13 19:53 丶Blank 阅读(135) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 24 下一页