上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 63 下一页
摘要: 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) 编辑
摘要: struct ListNode* middleNode(struct ListNode* head){ struct ListNode *p=head,*q=head; while(p) { if(p->next==NULL) { break; } if(p->next->next==NULL) { 阅读全文
posted @ 2020-09-18 19:32 温暖了寂寞 阅读(107) 评论(0) 推荐(0) 编辑
摘要: int minCostClimbingStairs(int* cost, int costSize){ int i,f1=0,f2=0; for (i=costSize-1; i>=0; i--) { int f0 = cost[i] + fmin(f1,f2); f2 = f1; f1 = f0; 阅读全文
posted @ 2020-09-18 18:41 温暖了寂寞 阅读(149) 评论(0) 推荐(0) 编辑
摘要: typedef struct { int top; int minIndex[10000]; int stack[10000]; } MinStack; MinStack* minStackCreate() { MinStack* obj = (MinStack*)calloc(1,sizeof(M 阅读全文
posted @ 2020-09-18 15:18 温暖了寂寞 阅读(148) 评论(0) 推荐(0) 编辑
摘要: int cmp(const void* a, const void* b){ return *(int*)a - *(int*)b; } int** minimumAbsDifference(int* arr, int arrSize, int* returnSize, int** returnCo 阅读全文
posted @ 2020-09-18 13:58 温暖了寂寞 阅读(197) 评论(0) 推荐(0) 编辑
摘要: int minCostToMoveChips(int* position, int positionSize){ int i,oddNum=0,evenNum=0; for (i=0; i<positionSize; i++) { (position[i] % 2)? oddNum++: evenN 阅读全文
posted @ 2020-09-18 10:56 温暖了寂寞 阅读(153) 评论(0) 推荐(0) 编辑
摘要: int cmp(const void* a, const void* b){ return *(int*)a - *(int*)b; } void func(struct TreeNode* root,int* arr,int* pst) { if (!root) return ; arr[(*ps 阅读全文
posted @ 2020-09-18 10:06 温暖了寂寞 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 给定一个有序整数数组,元素各不相同且按升序排列,编写一个算法,创建一棵高度最小的二叉搜索树。 示例: 给定有序数组: [-10,-3,0,5,9],一个可能的答案是:[0,-3,9,-10,null,5],它可以表示下面这个高度平衡二叉搜索树: 0 / \ -3 9 / / -10 5 /* mid 阅读全文
posted @ 2020-09-17 17:23 温暖了寂寞 阅读(118) 评论(0) 推荐(0) 编辑
摘要: /*双循环暴力解法*/ char ** findRestaurant(char ** list1, int list1Size, char ** list2, int list2Size, int* returnSize){ int i,j,n=0,pst=0,min=2000; char** ar 阅读全文
posted @ 2020-09-17 13:53 温暖了寂寞 阅读(133) 评论(0) 推荐(0) 编辑
上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 63 下一页