上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页
摘要: Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Each number in C may only be used once in the combination.Note:All numbers (including target) will be positive integers.Elements in a combination (a1, a2, … , 阅读全文
posted @ 2013-09-24 00:44 懒猫欣 阅读(151) 评论(0) 推荐(0)
摘要: Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of times.Note:All numbers (including target) will be positive integers.Elements in a combination (a1, a 阅读全文
posted @ 2013-09-24 00:37 懒猫欣 阅读(179) 评论(0) 推荐(0)
摘要: Reading Phone Number#include#include#include#include#include#include#include#include#define _USE_MATH_DEFINES#includeusing namespace std;string Sub(char val,int count){ if(count==0)return ""; string pre,after; bool sep=false; switch(count){ case 1: pre=""; break; case... 阅读全文
posted @ 2013-09-23 21:16 懒猫欣 阅读(322) 评论(0) 推荐(0)
摘要: Google 2013 campus test-R1 阅读全文
posted @ 2013-09-23 21:09 懒猫欣 阅读(161) 评论(0) 推荐(0)
摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as "one 2, then one 1" or 1211.Given an integer n, generate the nth sequence.Note: The 阅读全文
posted @ 2013-09-22 23:18 懒猫欣 阅读(155) 评论(0) 推荐(1)
摘要: Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its bottom-up level order traversal as:[ [15,7] [9,20], [3],]conf... 阅读全文
posted @ 2013-09-22 16:42 懒猫欣 阅读(307) 评论(0) 推荐(1)
摘要: Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its level order traversal as:[ [3], [9,20], [15,7]]confused what"{1,#,2,3}"means?> read more . 阅读全文
posted @ 2013-09-22 16:37 懒猫欣 阅读(170) 评论(0) 推荐(1)
摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note:Recursive solution is trivial, could you do it iteratively?confused what"{1,#,2,3}"means?> read more on how binary tree is serialized on OJ.OJ' 阅读全文
posted @ 2013-09-22 16:28 懒猫欣 阅读(148) 评论(0) 推荐(1)
摘要: Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation ofs1="great": great / \ gr eat / \ / \g r e at / \ a tTo scramble the string, we may choose any non-leaf no... 阅读全文
posted @ 2013-09-22 16:15 懒猫欣 阅读(159) 评论(0) 推荐(1)
摘要: 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 leaf node./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x... 阅读全文
posted @ 2013-09-22 00:32 懒猫欣 阅读(92) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页