上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 63 下一页
摘要: int Mycmp(const void* a,const void* b) { return *(int*)a % 2 - *(int*)b % 2; } int* sortArrayByParity(int* A, int ASize, int* returnSize){ qsort(A,ASi 阅读全文
posted @ 2020-09-05 15:14 温暖了寂寞 阅读(116) 评论(0) 推荐(0) 编辑
摘要: int* sortArrayByParityII(int* A, int ASize, int* returnSize){ int* arr = (int*)calloc(ASize,sizeof(int)); int evenindex = 0; int oddindex = 1; for (in 阅读全文
posted @ 2020-09-05 15:07 温暖了寂寞 阅读(105) 评论(0) 推荐(0) 编辑
摘要: int Fun(int x){ int res=0; while (x) res+=x&1,x>>=1; return res; } int Mycmp(const void* a,const void* b){ return (Fun(*(int*)a) - Fun(*(int*)b))? Fun 阅读全文
posted @ 2020-09-05 14:34 温暖了寂寞 阅读(157) 评论(0) 推荐(0) 编辑
摘要: int Mycmp(const void* a,const void* b){ return *(int*)a - *(int*)b; } void merge(int* A, int ASize, int m, int* B, int BSize, int n){ for (int i=m; i< 阅读全文
posted @ 2020-09-05 13:50 温暖了寂寞 阅读(119) 评论(0) 推荐(0) 编辑
摘要: int findString(char** words, int wordsSize, char* s){ for (int i=0; i<wordsSize; i++)if (!strcmp(words[i],s)) return i; return -1; } 阅读全文
posted @ 2020-09-05 13:15 温暖了寂寞 阅读(136) 评论(0) 推荐(0) 编辑
摘要: int balancedStringSplit(char * s){ int count=0,num = 0; for (int i=0; i<=strlen(s); i++) { (s[i] == 'R') ? count++:count--; if (!count) num++; } retur 阅读全文
posted @ 2020-09-05 12:07 温暖了寂寞 阅读(88) 评论(0) 推荐(0) 编辑
摘要: int Mycmp(const void* a,const void* b) { return *(int*)a - *(int*)b; } int* sortedSquares(int* A, int ASize, int* returnSize){ for (int i=0; i<ASize; 阅读全文
posted @ 2020-09-05 10:40 温暖了寂寞 阅读(117) 评论(0) 推荐(0) 编辑
摘要: int compress(char* chars, int charsSize){ int pst = 0; int anchor = 0; for (int i=0; i<charsSize; i++) { if (i == charsSize-1 || chars[i] != chars[i+1 阅读全文
posted @ 2020-09-04 18:54 温暖了寂寞 阅读(151) 评论(0) 推荐(0) 编辑
摘要: char ** stringMatching(char ** words, int wordsSize, int* returnSize){ char** arr = (char**)calloc(wordsSize,sizeof(char*)); int n =0; for (int i=0; i 阅读全文
posted @ 2020-09-04 15:04 温暖了寂寞 阅读(183) 评论(0) 推荐(0) 编辑
摘要: //如果s2 是s1的子串, 那么s2 必然在s1+s1里面 bool isFlipedString(char* s1, char* s2){ if (strlen(s1) != strlen(s2))return false; char* arr = (char*)calloc(sizeof(ch 阅读全文
posted @ 2020-09-04 13:16 温暖了寂寞 阅读(181) 评论(0) 推荐(0) 编辑
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 63 下一页