上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 25 下一页
摘要: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the total sum of all root-to-leaf numbers.For example, 1 / \ 2 3The root-to-leaf path 1->2 represents the num 阅读全文
posted @ 2013-08-11 15:26 冰点猎手 阅读(175) 评论(0) 推荐(0)
摘要: Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region .For example,X X X XX O O XX X O XX O X XAfter running your function, the board should be:X X X XX X X 阅读全文
posted @ 2013-08-11 15:11 冰点猎手 阅读(173) 评论(0) 推荐(0)
摘要: C++11 在类中引入了Move Constructor and the Move Assignmnt Operaetor,所谓‘move’指的是在复制对象时,left object 不用再创建资源,直接把right object 的资源当做自己的来用。而right object 的资源将全部被设置为default ,即为empty object 。http://blog.smartbear.com/c-plus-plus/c11-tutorial-introducing-the-move-constructor-and-the-move-assignment-operator/引入了关键字a 阅读全文
posted @ 2013-08-05 15:48 冰点猎手 阅读(1309) 评论(0) 推荐(0)
摘要: Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediate word must exist in the dictionaryFor example,Given:start = "hit"end = "cog"dict = ["h 阅读全文
posted @ 2013-08-04 22:29 冰点猎手 阅读(182) 评论(0) 推荐(0)
摘要: Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once.For example,Given board =[ [ 阅读全文
posted @ 2013-08-04 21:36 冰点猎手 阅读(192) 评论(0) 推荐(0)
摘要: Implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not partial).The function prototype should be:bool isMatch(const ch 阅读全文
posted @ 2013-08-03 17:24 冰点猎手 阅读(209) 评论(0) 推荐(0)
摘要: Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching should cover the entire input string (not partial).The function prototype should be:boo 阅读全文
posted @ 2013-08-03 16:07 冰点猎手 阅读(162) 评论(0) 推荐(0)
摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"Corner Cases:Did you consider the case where path = "/../"?In this case, you should return "/".Another 阅读全文
posted @ 2013-08-02 22:36 冰点猎手 阅读(202) 评论(0) 推荐(0)
摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.Note:You are not suppose to use the 阅读全文
posted @ 2013-08-02 20:16 冰点猎手 阅读(173) 评论(0) 推荐(0)
摘要: Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]] class Solution {public: vector > generateMatrix(int n) { // Start typing your C/C++ soluti... 阅读全文
posted @ 2013-08-02 19:45 冰点猎手 阅读(179) 评论(0) 推荐(0)
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 25 下一页