上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 63 下一页
摘要: /*赋值解法*/ bool hasCycle(struct ListNode *head) { while(head) { if (head->val == 1000000) return true; head->val=1000000; head=head->next; } return fals 阅读全文
posted @ 2020-09-22 18:56 温暖了寂寞 阅读(130) 评论(0) 推荐(0) 编辑
摘要: bool isLongPressedName(char * name, char * typed){ if (*name++ != *typed++) return false; while(*name || *typed) { if (*typed++ == *name) name++; if ( 阅读全文
posted @ 2020-09-22 18:29 温暖了寂寞 阅读(153) 评论(0) 推荐(0) 编辑
摘要: char * longestCommonPrefix(char ** strs, int strsSize){ int i,j,pst=0; char* str = (char*)calloc(1000,sizeof(char)); if (strsSize==0) return str; for 阅读全文
posted @ 2020-09-22 17:37 温暖了寂寞 阅读(144) 评论(0) 推荐(0) 编辑
摘要: int findLengthOfLCIS(int* nums, int numsSize){ int i,count=1,max=1; for (i=1; i<numsSize; i++) { if (nums[i] > nums[i-1]) { count++; } else { if (coun 阅读全文
posted @ 2020-09-22 17:02 温暖了寂寞 阅读(141) 评论(0) 推荐(0) 编辑
摘要: int cmp(const void* a, const void* b){ return *(int*)a - *(int*)b; } int findLHS(int* nums, int numsSize){ qsort(nums,numsSize,sizeof(int),cmp); int i 阅读全文
posted @ 2020-09-22 16:11 温暖了寂寞 阅读(138) 评论(0) 推荐(0) 编辑
摘要: int longestPalindrome(char * s){ int hash[58] = {0}; int i,oodMax=0,len=strlen(s),sum=0; for (i=0; i<len; i++) { hash[s[i]-'A']++; } for (i=0; i<58; i 阅读全文
posted @ 2020-09-22 14:41 温暖了寂寞 阅读(85) 评论(0) 推荐(0) 编辑
摘要: int findLUSlength(char * a, char * b){ return (!strcmp(a,b))? -1 : (strlen(a)>strlen(b))? strlen(a): strlen(b); } 阅读全文
posted @ 2020-09-22 14:01 温暖了寂寞 阅读(111) 评论(0) 推荐(0) 编辑
摘要: /*当前节点于上一个相对根节点比较*/ int recursion(struct TreeNode* node, struct TreeNode* root,int* max){ if(!node) return 0; int left = recursion(node->left,node,max 阅读全文
posted @ 2020-09-22 12:33 温暖了寂寞 阅读(193) 评论(0) 推荐(0) 编辑
摘要: struct TreeNode* lowestCommonAncestor(struct TreeNode* root, struct TreeNode* p, struct TreeNode* q) { if(root == NULL){ return NULL; } if(q->val > ro 阅读全文
posted @ 2020-09-21 17:30 温暖了寂寞 阅读(131) 评论(0) 推荐(0) 编辑
摘要: int* luckyNumbers (int** matrix, int matrixSize, int* matrixColSize, int* returnSize){ int i,j,k,count=0,min,col,pst=0; int* retArr = (int*)malloc(siz 阅读全文
posted @ 2020-09-21 16:24 温暖了寂寞 阅读(188) 评论(0) 推荐(0) 编辑
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 63 下一页