摘要:
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled from 0 to N - 1, where N is the total nodes in the graph. We use # as a separator for each node, and , as a separator for each neighbor of the no 阅读全文
posted @ 2014-04-12 02:24
beehard
阅读(115)
评论(0)
推荐(0)
摘要:
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example, given s = "catsanddog", dict = ["cat", "cats", "and", "sand", " 阅读全文
posted @ 2014-04-12 02:16
beehard
阅读(179)
评论(0)
推荐(0)
摘要:
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = "leetcode", dict = ["leet", "code"]. Return true because "leetcode" can be segmented as &qu 阅读全文
posted @ 2014-04-12 01:58
beehard
阅读(174)
评论(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] ] 1 class Solution { 2 public: 3 vector > generate(int numRows) { 4 vector > res(numRows); 5 for(int i = 0; i = 1) r... 阅读全文
posted @ 2014-04-12 01:40
beehard
阅读(105)
评论(0)
推荐(0)

浙公网安备 33010602011771号