Given a set of distinct integers, 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 exa...
分类:
其他好文 时间:
2014-08-01 23:18:42
阅读次数:
246
问题:删除数组中和elem相等的元素,并且返回新数组大小。英语不好。。。读错题了。。class Solution {public: int removeElement(int A[], int n, int elem) { int i,j; for(int i=0;...
分类:
其他好文 时间:
2014-08-01 23:03:22
阅读次数:
223
iOS开发Swift篇—(八)函数(2)一、函数类型函数类型也是数据类型的一种,它由形参类型和返回值类型组成,格式是(形参类型列表) -> 返回值类型1 func sum(num1: Int, num2: Int) -> Int {2 return num1 + num23 }sum函数的函...
分类:
移动开发 时间:
2014-08-01 22:54:02
阅读次数:
211
#include using namespace std;int a[1000];int f(int n){ int k=0; while(n) { a[k++]=n%2; n/=2; } return k;}int main(int argc, char *argv[]){ int n,m,...
分类:
其他好文 时间:
2014-08-01 22:45:22
阅读次数:
248
Code:: 播放 if(!m_animate1.Open("C:\\copy.avi")) { MessageBox("NULL"); return; } m_animate1.Play(0...
分类:
编程语言 时间:
2014-08-01 22:40:52
阅读次数:
271
简单的BFS。无需任何优化。利用一个结构体数组储存状态,三个量a,b,move分别表示A箱,B箱的球数以及移动次数。注意对特殊情况的处理以及对不可能情况的判定:(1)两数之差为奇数,由题意,假设aMAXMOVE){ return -1; break; } //printf("Fr...
分类:
其他好文 时间:
2014-08-01 22:39:32
阅读次数:
274
AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.编程珠玑中的一道题,书中的解法很巧妙,我就直接搬来用了,时...
分类:
其他好文 时间:
2014-08-01 22:37:32
阅读次数:
162
内联函数:在函数声明和函数定义前加上inline一个简单的计算平方的代码:#include using namespace std; inline double square(double x) { return x * x; }; int main() { cou...
分类:
其他好文 时间:
2014-08-01 22:32:42
阅读次数:
190
问题:翻转数字分析:注意初始化class Solution {public: int reverse(int x) { int y=0; while(x) { y=(y*10)+x%10; x/=10; ...
分类:
其他好文 时间:
2014-08-01 22:32:12
阅读次数:
174
1.MFC下生成动态库1>显式调用在.cpp文件里添加接口函数1 int sum(int a,int b)2 {3 return a + b;4 }5 6 int sub(int a,int b)7 {8 return a - b;9 }在.def文件里标示导出接口1 sum @1;...