摘要:
int compareVersion(char * version1, char * version2){ int i, j, start1, start2, num1, num2, len1 = strlen(version1), len2 = strlen(version2); for (i = 阅读全文
摘要:
int cmp(const void*a,const void*b){ char s1[100],s2[100]; sprintf(s1,"%d%d",*(int *)a,*(int *)b); sprintf(s2,"%d%d",*(int *)b,*(int *)a); return strcm 阅读全文
摘要:
int evalRPN(char ** tokens, int tokensSize){ int stack[5000], i, top=0; for (i=0; i<tokensSize; i++){ if ( isdigit(tokens[i][0]) || strlen(tokens[i])> 阅读全文
摘要:
int findPeakElement(int* nums, int numsSize){ int l = 0, r = numsSize - 1; while (l < r) { int mid = (l + r) / 2; if (nums[mid] > nums[mid + 1]) r = m 阅读全文
摘要:
int findMin(int* nums, int numsSize){ if (numsSize==1) return *nums; int left=0, right=numsSize-1, mid; while(left<right){ mid=(left+right)/2; if(mid> 阅读全文