题目:Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space....
分类:
编程语言 时间:
2014-07-27 21:26:35
阅读次数:
267
函数函数是具有特定功能的代码块,函数使得程序更加模块化,这样便于人们阅读,修改,完善程序1.函数的定义:返回值类型函数名(形式参数){声明语句}无参函数举例voidhello()//无参数无返回值{printf(“HelloWorld");}intpeopleCount()//无参数有返回值{return33;}有参函数举例intmax..
分类:
其他好文 时间:
2014-07-27 14:19:58
阅读次数:
342
#include
#define N 9
int fun(int a[],int n)
{
int i,j=0;
for(i=0;i<n;i++)
if(a[i]%2==0)
{
a[j]=a[i];
j++;
}
return j;
}
main()
{
int b[N]={9,7,5,3,4,6,8,2,1},i,n;
printf("\nThe origi...
分类:
其他好文 时间:
2014-07-27 11:30:12
阅读次数:
166
#include
#include
#define M 5
#define N 20
int fun(char (*ss)[N],int *n)
{
int i,k=0,len=N;
for(i=0;i<M;i++)
{
len=strlen(ss[i]);
if(i==0)*n=len;
if(len<*n){
*n=len;
k=i;
}
}
return k;...
分类:
其他好文 时间:
2014-07-27 11:28:32
阅读次数:
190
本设计模式就是利用不同的类包起不同的命令,达到使用什么命令就实现什么操作。
也可以进一步利用map和自己喜欢的命令词对接起来。
一个执行类实际上已经包含了所有需要的操作了,如:
class SuperMaker
{
public:
string makeCar()
{
return "Car";
}
string makePlane()
{
return "Plane";
...
分类:
其他好文 时间:
2014-07-27 11:19:32
阅读次数:
202
java实现的字符串翻转,能想到的这几种方法
如果有其他方法,欢迎交流
//字符串反转
public class ReverseString {
public String reverse1(String str){
StringBuffer sb = new StringBuffer(str);
str = sb.reverse().toString();
return str...
分类:
其他好文 时间:
2014-07-27 11:09:12
阅读次数:
211
题目:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.题解:这道题跟NQueens的解法完全一样(具....
分类:
编程语言 时间:
2014-07-27 11:00:42
阅读次数:
241
题目: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 a....
分类:
编程语言 时间:
2014-07-27 11:00:22
阅读次数:
262
转自:http://blog.csdn.net/swingpyzf/article/details/17091567IOS开发中经常要用到输入框,默认情况下点击输入框就会弹出键盘,但是必须要实现输入框return的委托方法才能取消键盘的显示,对于用户体验来说很不友好,我们可以实现点击键盘以外的空白区...
分类:
移动开发 时间:
2014-07-27 10:54:22
阅读次数:
255
实现: 1 #include "c2_list.h" 2 3 template 4 class Stack{ 5 public: 6 bool isEmpty() const 7 {return _list.empty();} 8 9 const object& top...
分类:
其他好文 时间:
2014-07-27 10:45:32
阅读次数:
201