上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 63 下一页
摘要: char * toGoatLatin(char * S){ char* buffer; char* retStr = (char*)calloc(2000,sizeof(char)); char* vowel = "aeiouAEIOU"; int pst=0,i,count=1; buffer = 阅读全文
posted @ 2020-09-27 18:33 温暖了寂寞 阅读(148) 评论(0) 推荐(0) 编辑
摘要: char *gcdOfStrings(char *str1, char *str2) { //if (strstr(str1, str2) == NULL && strstr(str2, str1) == NULL) 原答案 //如果最大公因子有的话,那必定是有一个包含其中一个,实际就是长的包含短的 阅读全文
posted @ 2020-09-27 17:23 温暖了寂寞 阅读(158) 评论(0) 推荐(0) 编辑
摘要: int cmpChar(const void *a, const void *b) { return *(char *)a - *(char *)b; } int cmpStr(const void *a, const void *b) { return strcmp(*(char **)a, *( 阅读全文
posted @ 2020-09-27 14:10 温暖了寂寞 阅读(139) 评论(0) 推荐(0) 编辑
摘要: int guessNumber(int n){ int num = 1+(n-1)/2; int left=1,right=n; while(1) { int ret = guess(num); if(ret == 1) left=num+1; else if(ret == -1) right=nu 阅读全文
posted @ 2020-09-27 10:33 温暖了寂寞 阅读(139) 评论(0) 推荐(0) 编辑
摘要: int game(int* guess, int guessSize, int* answer, int answerSize){ int count=0; for (int i=0; i<3; i++) if (guess[i]==answer[i]) count++; return count; 阅读全文
posted @ 2020-09-27 09:45 温暖了寂寞 阅读(146) 评论(0) 推荐(0) 编辑
摘要: int hammingDistance(int x, int y){ x = x^y; int num=0; while(x){ num += x & 1; x >>=1; } return num; } 阅读全文
posted @ 2020-09-27 09:36 温暖了寂寞 阅读(104) 评论(0) 推荐(0) 编辑
摘要: #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) int cmp(const void* a,const void* b){ return *(int*)a > *(int*)b; } int findRadi 阅读全文
posted @ 2020-09-26 17:07 温暖了寂寞 阅读(156) 评论(0) 推荐(0) 编辑
摘要: int heightChecker(int* heights, int heightsSize){ int hash[101]={0}; int i,j,count=0; for (i=0; i<heightsSize; i++) hash[heights[i]]++; for (i=0,j=1; 阅读全文
posted @ 2020-09-26 14:08 温暖了寂寞 阅读(136) 评论(0) 推荐(0) 编辑
摘要: int rob(int* nums, int numsSize){ if (!numsSize) return 0; if (numsSize>1 && nums[0]>nums[1]) nums[1]=nums[0]; for (int i=2; i<numsSize; i++) { if (nu 阅读全文
posted @ 2020-09-26 12:34 温暖了寂寞 阅读(154) 评论(0) 推荐(0) 编辑
摘要: int cmp(const void* a,const void* b){ return *(int*)a > *(int*)b; } int* smallerNumbersThanCurrent(int* nums, int numsSize, int* returnSize){ int hash 阅读全文
posted @ 2020-09-26 11:38 温暖了寂寞 阅读(128) 评论(0) 推荐(0) 编辑
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 63 下一页