有一个长为n的数组A,求满足0≤a≤b<n的A[b]-A[a]的最大值。给定数组A及它的大小n,请返回最大差值。测试样例:[10,5],2返回:0classLongestDistance{
public:
intgetDis(vector<int>A,intn){//时间复杂度O(n)空间复杂度O(1)
//writecodehere
intmaxDiff=0;//初始化最..
分类:
其他好文 时间:
2016-09-09 18:54:03
阅读次数:
296
30% n<=2 50% 0<=a,b,g,k<=100 100% 0<=n<=10000, 0<=a,b,g,k<=100000 这道题感谢黄学长的代码,感谢hzwer~~~~~~ 好吧,我承认这道题很水 #include<iostream> using namespace std; int ma ...
分类:
其他好文 时间:
2016-09-09 18:46:43
阅读次数:
129
常见基本类型的字节大小 32位操作系统 char :1个字节(固定) *(即指针变量): 4个字节(32位机的寻址空间是4个字节。同理64位编译器)(变化*) short int : 2个字节(固定) int: 4个字节(固定) unsigned int : 4个字节(固定) float: 4个字节 ...
分类:
其他好文 时间:
2016-09-09 17:00:39
阅读次数:
259
判断字符串是不是数字? 方法一: /** * 用于验证获取的字符串是不是数字 * @param str * @return */ public static boolean isNumeric(String str) { for (int i = 0; i < str.length(); i++) ...
分类:
其他好文 时间:
2016-09-09 16:42:32
阅读次数:
115
关键:将数组的地址送到函数中;其中数组名可以作为函数的首地址。 #include<stdio.h>int sort(int *p,int n){ int i,j,ret=0,temp; if(p==NULL) {printf("error:sort(int *p)%d",ret); return r ...
分类:
编程语言 时间:
2016-09-09 15:14:44
阅读次数:
152
#include <iostream> using namespace std; void hanno(char a,char b,char c,int s){ if(s==1) { cout<<a<<" "<<c<<endl; return; } else{ hanno(a,c,b,s-1); c ...
分类:
其他好文 时间:
2016-09-09 15:00:45
阅读次数:
124
public List<string[]> SetList(DataTable dt) { List<string[]> list = new List<string[]>(); foreach (DataRow r in dt.Rows) { int colCount = r.ItemArray. ...
分类:
其他好文 时间:
2016-09-09 14:59:19
阅读次数:
122
POSIX 线程,也被称为Pthreads,是一个线程的POSIX标准; pthread.h int pthread_create(pthread_t * thread, pthread_attr_t const *attr, void *(*start_routine)(void*), void ...
分类:
其他好文 时间:
2016-09-09 14:50:17
阅读次数:
150
1)当==两边是对象时(String,Integer...),两边比的都是地址2)当==两边是基本类型时(int,float),两边比的都是值3)默认equals比的是对象的地址,但是重写的话可以改变成比较值,String和Integer的equals就是重写过的 废话少说,Run!!! 对于Int ...
分类:
编程语言 时间:
2016-09-09 11:55:04
阅读次数:
156
4.5 - Apps using background location services must provide a reason that clarifies the purpose of the use, using mechanisms described in the Human Int ...
分类:
移动开发 时间:
2016-09-09 11:54:36
阅读次数:
191