摘要: int maxProduct(int* nums, int numsSize){ int num1=0,num2=0,i; for(i=0; i<numsSize; i++) { if(nums[i] > num1) { num2 = num1; num1 = nums[i]; } else if( 阅读全文
posted @ 2020-09-19 23:04 温暖了寂寞 阅读(213) 评论(0) 推荐(0) 编辑
摘要: int maxScore(char * s){ int zeroNum=0,oneNum=0,i,total=0; int len = strlen(s); for(i=0; i<len; i++) { if(s[i] == '1') oneNum++; } for(i=0; i<len-1; i+ 阅读全文
posted @ 2020-09-19 22:53 温暖了寂寞 阅读(328) 评论(0) 推荐(0) 编辑
摘要: int maxSubArray(int* nums, int numsSize){ int i=1,max=nums[0]; for (; i<numsSize; i++) { if (nums[i-1]>0 && nums[i] + nums[i-1] > nums[i]) nums[i] = n 阅读全文
posted @ 2020-09-19 13:37 温暖了寂寞 阅读(116) 评论(0) 推荐(0) 编辑
摘要: void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n){ int index1 = m - 1; int index2 = n - 1; int currIndex = m + n - 1; whi 阅读全文
posted @ 2020-09-19 10:20 温暖了寂寞 阅读(156) 评论(0) 推荐(0) 编辑
摘要: struct TreeNode* mergeTrees(struct TreeNode* t1, struct TreeNode* t2){ if(t1==NULL&&t2!=NULL) return t2; else if(t2==NULL&&t1!=NULL) return t1; else i 阅读全文
posted @ 2020-09-19 09:56 温暖了寂寞 阅读(166) 评论(0) 推荐(0) 编辑
摘要: struct ListNode* mergeTwoLists(struct ListNode* l1, struct ListNode* l2){ struct ListNode* head = (struct ListNode*)calloc(sizeof(struct ListNode),1); 阅读全文
posted @ 2020-09-19 00:35 温暖了寂寞 阅读(119) 评论(0) 推荐(0) 编辑