Problem Description:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Solution: 递归。 1 public List>...
分类:
其他好文 时间:
2014-07-07 16:59:12
阅读次数:
169
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorte...
分类:
其他好文 时间:
2014-07-07 16:53:17
阅读次数:
196
Problem Description:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to...
分类:
其他好文 时间:
2014-07-07 16:22:28
阅读次数:
129
Problem Description:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integ...
分类:
其他好文 时间:
2014-06-30 14:32:54
阅读次数:
151
【题目】
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", "dog...
分类:
其他好文 时间:
2014-06-30 00:51:41
阅读次数:
295
题目
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
You have the following 3 operations permitte...
分类:
其他好文 时间:
2014-06-30 00:46:38
阅读次数:
262
题目
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-que...
分类:
其他好文 时间:
2014-06-30 00:34:18
阅读次数:
188
题目
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approa...
分类:
其他好文 时间:
2014-06-29 23:44:02
阅读次数:
357
Candy
Total Accepted: 12392 Total
Submissions: 68386My Submissions
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these childre...
分类:
其他好文 时间:
2014-06-29 23:15:17
阅读次数:
228
【题目】
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep copy of the list.
【题意】
给定一个链表,每个节点除了next指针外,还有一个random指针,指向任意的节点。
要求,复制这样的一个链表
【思路】
思路...
分类:
其他好文 时间:
2014-06-29 20:41:21
阅读次数:
232