摘要: 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) 编辑