题目:和上一题一样,就是这时候给定的数字可能有重复。做法:只要将num排好序,然后判断如果当前的值等于前一个的话,那么就跳过,就不会有重复的人。果然是AC了。 1 class Solution { 2 public: 3 vector > permuteUnique(vector &num)...
分类:
其他好文 时间:
2014-10-29 01:55:09
阅读次数:
154
吉哥系列故事——完美队形IITime Limit: 3000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1075Accepted Submission(s): 388Probl...
分类:
其他好文 时间:
2014-10-29 01:38:29
阅读次数:
179
题意:给出三角形ABC顶点的坐标,DEF分别是三边的三等分点。求交点所形成的三角形PQR的面积。分析:根据梅涅劳斯定理,我们得到:,解得 另外还有:,解得 所以AR : RP : PD = 3 : 3 : 1同理,BE和CF也被分成这样比例的三段。△ADC = (2/3)△ABC△CDR = (4/...
分类:
其他好文 时间:
2014-10-28 11:47:15
阅读次数:
180
问题描述:
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,...
分类:
其他好文 时间:
2014-10-27 21:21:00
阅读次数:
190
The Triangle
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 38195
Accepted: 22946
Description
7
3 8
8 1 0
2 7 4 4
4 5 2 6 5
(Figu...
分类:
其他好文 时间:
2014-10-27 19:37:23
阅读次数:
189
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...
分类:
其他好文 时间:
2014-10-27 17:33:44
阅读次数:
223
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],
...
分类:
其他好文 时间:
2014-10-27 15:36:28
阅读次数:
190
问题描述:
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
/...
分类:
其他好文 时间:
2014-10-26 14:24:00
阅读次数:
224
问题描述:
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?
思路:
...
分类:
其他好文 时间:
2014-10-26 11:46:08
阅读次数:
251
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 exa...
分类:
其他好文 时间:
2014-10-26 06:47:17
阅读次数:
187