problem:
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],
...
分类:
其他好文 时间:
2015-03-30 16:22:10
阅读次数:
108
const int MAXN = 110;//点
const int MAXM = 10000;//边int f[MAXN];//并查集使用struct Edge
{
int u, v, w;
}edge[MAXN];int tol;//边数 初始化 0void addedge(int u,int v,int w)
{
edge[tol].u = u;
edge[tol].v...
分类:
其他好文 时间:
2015-03-29 21:01:45
阅读次数:
165
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen...
分类:
其他好文 时间:
2015-03-29 21:00:12
阅读次数:
151
/* 简单dp,转态转移方程dp[i][j] = dp[i-1][j]+dp[i][j-1];初始化下边界*/class Solution {public: int uniquePaths(int m, int n) { if(m<0||n<0) return 0; ...
分类:
其他好文 时间:
2015-03-29 20:51:07
阅读次数:
122
题目:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 ...
分类:
其他好文 时间:
2015-03-29 15:11:19
阅读次数:
106
'郑州','北京',9=>'上海','郑州');print_r($arr);$c=array_unique($arr);//消除重复的元素值,并进行索引排列 print_r($c);$b=array_values($arr);//重新排序数组print_r($b); $arr1=array('...
分类:
编程语言 时间:
2015-03-29 10:38:41
阅读次数:
160
题目链接:combination-sum
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
*
Given a set of candidate numbers (C) and a target number (T),
find all unique combin...
分类:
其他好文 时间:
2015-03-29 09:30:28
阅读次数:
159
C++智能指针主要是在普通指针的基础上封装了一层,使得使用者对指针的使用更加方便和放心,在使用的过程中不用担心指针因为释放问题而导致的异常。在C++11中,智能指针主要有三种:shared_ptr ptr, unique_ptr ptr, weak_ptr ptr;
shared_ptr ptr的初始化可以通过以下几种方式:
1)shared_ptr ptr = m...
分类:
编程语言 时间:
2015-03-29 01:54:51
阅读次数:
215
智能指针在C++11的标准中已经存在了,分别是unique_ptr,shared_ptr,weak_ptr,其中最常用的应该是share_ptr,它采用引用计数的方式管理内存,当引用计数为0的时候,自动释放内存,但是由于shared_ptr考虑到了线程安全,所以会存在有较大的性能损失。所以在实时游戏开发中,往往不会用到shared_ptr。
在cocos2d-x3.2以及更高的版本中,cocos...
分类:
其他好文 时间:
2015-03-28 13:04:33
阅读次数:
750
The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie...
分类:
其他好文 时间:
2015-03-28 06:23:49
阅读次数:
124