上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 63 下一页
摘要: bool checkIfExist(int* arr, int arrSize){ int hash[12001] = { 0 }, i; for (i = 0; i<arrSize; i++){ if (hash[(arr[i] * 2 + 3000)] || (arr[i] % 2 == 0 & 阅读全文
posted @ 2020-11-28 20:00 温暖了寂寞 阅读(75) 评论(0) 推荐(0) 编辑
摘要: bool arrayStringsAreEqual(char ** word1, int word1Size, char ** word2, int word2Size){ char s1[1001]={0}; char s2[1001]={0}; int i; for(i=0; i<word1Si 阅读全文
posted @ 2020-11-28 18:50 温暖了寂寞 阅读(147) 评论(0) 推荐(0) 编辑
摘要: int isPrefixOfWord(char * sentence, char * searchWord){ char* buffer; int pst=1; buffer=strtok(sentence," "); while(buffer){ if(strstr(buffer,searchWo 阅读全文
posted @ 2020-11-27 23:31 温暖了寂寞 阅读(86) 评论(0) 推荐(0) 编辑
摘要: bool CheckPermutation(char* s1, char* s2){ int len1=strlen(s1), len2=strlen(s2); if(len1 != len2) return false; int i, hash[26]={0}; for(i=0; i<len1; 阅读全文
posted @ 2020-11-27 21:26 温暖了寂寞 阅读(61) 评论(0) 推荐(0) 编辑
摘要: int climbStairs(int n){ int i, pre=1, prepre=0, cur=0; for(i=1; i<=n; i++){ cur=pre+prepre; prepre=pre; pre=cur; } return cur; } 阅读全文
posted @ 2020-11-27 21:11 温暖了寂寞 阅读(65) 评论(0) 推荐(0) 编辑
摘要: void dfs(int** image, int imageSize, int colsize, int r, int c, int newColor, int initColor){ if(r<0 || r>=imageSize || c<0 || c>=colsize || image[r][ 阅读全文
posted @ 2020-11-27 19:50 温暖了寂寞 阅读(137) 评论(0) 推荐(0) 编辑
摘要: int getRes(char *str){ int len = strlen(str); char c = 'z'; int ht[26] = {0}; for(int i=0; i<len; i++){ ht[str[i]-'a']++; c = str[i] < c ? str[i] : c; 阅读全文
posted @ 2020-11-27 16:55 温暖了寂寞 阅读(100) 评论(0) 推荐(0) 编辑
摘要: int bitwiseComplement(int N){ int cnt=0, val=0; if(N==0) return 1; while(N){ val += !(N&1)*pow(2,cnt++); N>>=1; } return val; } 阅读全文
posted @ 2020-11-27 12:36 温暖了寂寞 阅读(87) 评论(0) 推荐(0) 编辑
摘要: int maxPower(char * s){ int i, cnt=0, maxLen=0, len=strlen(s); for(i=0; i<len; i++){ cnt++; if(i==len-1 || s[i]!=s[i+1]){ if(cnt>maxLen) maxLen=cnt; c 阅读全文
posted @ 2020-11-27 09:47 温暖了寂寞 阅读(147) 评论(0) 推荐(0) 编辑
摘要: #define MAX_SIZE 50000 void transfer_bitree(struct TreeNode* t, char *s, int *len) { if (t) { *len += sprintf(s + *len, "%d", t->val); if (t->left || 阅读全文
posted @ 2020-11-26 23:07 温暖了寂寞 阅读(113) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 63 下一页