上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 25 下一页
摘要: 我的美国CS面试经验分享 -- 转载怎样花两年时间去面试一个人上面列出了一些比较好的书单cs土硕找工作总结(二) 笔试面试准备http://blog.renren.com/blog/221227065/886156817 阅读全文
posted @ 2013-08-12 21:32 冰点猎手 阅读(187) 评论(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's. 1 3 3 2 1 \ / / / \ \ 3 2 1 1 3 2 / / \ \ 2 ... 阅读全文
posted @ 2013-08-12 20:29 冰点猎手 阅读(181) 评论(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 is pretty straight forward. Could you devise a constant space solution?confused what "{1,#,2,3}" means? > read more on how binary tree is se 阅读全文
posted @ 2013-08-11 22:51 冰点猎手 阅读(344) 评论(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 and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1return[ [5,4,11,2... 阅读全文
posted @ 2013-08-11 20:22 冰点猎手 阅读(162) 评论(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 still work?Note:You may only use constant extra space.For example,Given the following binary tree, 1 / \ 2 3 / \ \ 4 5 ... 阅读全文
posted @ 2013-08-11 19:58 冰点猎手 阅读(205) 评论(0) 推荐(0)
摘要: Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.Initially, all next pointers are set to NULL... 阅读全文
posted @ 2013-08-11 19:19 冰点猎手 阅读(205) 评论(0) 推荐(0)
摘要: Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space? class Solution {public: vector getRow(int rowIndex) { // Start typing your C/C++ solution below // DO NOT wri... 阅读全文
posted @ 2013-08-11 16:53 冰点猎手 阅读(177) 评论(0) 推荐(0)
摘要: Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]] class Solution {public: vector > generate(int numRows) { // Start typing your C/C++ solution below // DO NOT write int main()... 阅读全文
posted @ 2013-08-11 16:33 冰点猎手 阅读(165) 评论(0) 推荐(0)
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [3,4], [6,5,7], [4,1,8,3]]The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11).Note:Bonus point if... 阅读全文
posted @ 2013-08-11 16:23 冰点猎手 阅读(206) 评论(0) 推荐(0)
摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a palindrome.Note:Have you consider that the string might be empty? This is a good questio 阅读全文
posted @ 2013-08-11 15:57 冰点猎手 阅读(206) 评论(0) 推荐(0)
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 25 下一页