【题目】
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array A = [1,1,1,2,2,3],
Your function should return length = 5, and A is now [1,1,2,2,3].
【题意】
给定一个有序数组,给数组去重,和Remove Duplicates from...
分类:
其他好文 时间:
2014-06-03 05:36:24
阅读次数:
219
[问题2014S15] 设 \(O\) 为 \(n\)
阶正交阵,\(A=\mathrm{diag}\{a_1,a_2,\cdots,a_n\}\) 为实对角阵, 证明: 方阵 \(OA\) 的特征值
\(\lambda_j\) 适合不等式: \[m\leq |\lambda_j|\leq M,\,...
分类:
其他好文 时间:
2014-06-02 20:45:15
阅读次数:
246
问题:
返回N皇后问题解的个数。
分析:
详见 N-queens
实现:
bool nextPermutation(vector &num)
{
int i = num.size() - 1;
while (i >= 1)
{
if(num[i] > num[i - 1])
{
--i;
int ii = num.size() - 1;
while (i...
分类:
其他好文 时间:
2014-06-01 18:24:45
阅读次数:
398
【题目】
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
1 3 3 2 1
\ / / / \ ...
分类:
其他好文 时间:
2014-06-01 15:33:45
阅读次数:
297
【题目】
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m = 2 and n = 4,
return 1->4->3->2->5->NULL.
Note:
Given m, n satisfy the following condition:
1 ≤ m ≤ n ≤ length of list.
【题意】
...
分类:
其他好文 时间:
2014-06-01 15:08:34
阅读次数:
237
问题:
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
For example,
[1,1,2] have the following unique permutations:
[1,1,2], [1,2,1],
and...
分类:
其他好文 时间:
2014-06-01 13:03:12
阅读次数:
324
***************************************************************************************************************************
作者:EasyWave 时间:2014.05.31
类别:μC/OS-II-操作系统...
分类:
其他好文 时间:
2014-06-01 09:39:49
阅读次数:
356
***************************************************************************************************************************
作者:EasyWave 时间:2014.05.31...
分类:
其他好文 时间:
2014-06-01 09:13:14
阅读次数:
258
***************************************************************************************************************************
作者:EasyWave 时间:2014.05.31...
分类:
其他好文 时间:
2014-06-01 09:07:52
阅读次数:
305
【题目】
Given a collection of integers that might contain duplicates, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.
The solution set must not contain duplicate subsets.
For example,
If S = [1,2,2], a solution ...
分类:
其他好文 时间:
2014-06-01 08:51:06
阅读次数:
292