摘要: int compareVersion(char * version1, char * version2){ int i, j, start1, start2, num1, num2, len1 = strlen(version1), len2 = strlen(version2); for (i = 阅读全文
posted @ 2020-12-24 22:01 温暖了寂寞 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-12-24 17:47 温暖了寂寞 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 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])> 阅读全文
posted @ 2020-12-24 14:40 温暖了寂寞 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-12-24 12:22 温暖了寂寞 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 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> 阅读全文
posted @ 2020-12-24 09:51 温暖了寂寞 阅读(45) 评论(0) 推荐(0) 编辑