上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 63 下一页
摘要: int cmp_up(void *a, void *b) { return *(int *)a - *(int *)b; } int majorityElement(int *nums, int numsSize) { qsort(nums, numsSize, sizeof(int), cmp_u 阅读全文
posted @ 2020-08-20 15:22 温暖了寂寞 阅读(174) 评论(0) 推荐(0) 编辑
摘要: int findRepeatNumber(int* nums, int numsSize){ int max = nums[0]; for (int j = 1; j<numsSize; j++) { if (nums[j] > max) max = nums[j]; } int *hash = ( 阅读全文
posted @ 2020-08-20 13:29 温暖了寂寞 阅读(198) 评论(0) 推荐(0) 编辑
摘要: int fib(int n){ if (n == 0) return 0; if (n == 1 || n == 2) return 1; int pre=1; int prepre=1; int curr = 0; for (int i=3; i <= n; i++) { curr = (pre 阅读全文
posted @ 2020-08-20 11:22 温暖了寂寞 阅读(139) 评论(0) 推荐(0) 编辑
摘要: int minArray(int* numbers, int numbersSize){ int min = numbers[0]; for (int i=1; i<numbersSize; i++) { if (numbers[i]<min) min = numbers[i]; } return 阅读全文
posted @ 2020-08-20 10:58 温暖了寂寞 阅读(101) 评论(0) 推荐(0) 编辑
摘要: int comp(void *a,void *b){ return *(int*)a-*(int*)b; } int* getLeastNumbers(int* arr, int arrSize, int k, int* returnSize){ qsort(arr,arrSize,sizeof(i 阅读全文
posted @ 2020-08-19 20:35 温暖了寂寞 阅读(128) 评论(0) 推荐(0) 编辑
摘要: void quick(int* arr,int start,int end) { int left = start; int right = end; int mid = arr[start]; while(left < right) { while(left < right) { if (arr[ 阅读全文
posted @ 2020-08-19 20:32 温暖了寂寞 阅读(163) 评论(0) 推荐(0) 编辑
摘要: int* constructArr(int* a, int aSize, int* returnSize){ int *arr = NULL; int i, temp; if (a == NULL || aSize <= 1) { *returnSize = 0; return a; } *retu 阅读全文
posted @ 2020-08-19 14:35 温暖了寂寞 阅读(142) 评论(0) 推荐(0) 编辑
摘要: . int* maxSlidingWindow(int* nums, int numsSize, int k, int* returnSize){ if (nums == NULL || numsSize == 0){ *returnSize = 0;//传参检查 return NULL; } *r 阅读全文
posted @ 2020-08-19 13:47 温暖了寂寞 阅读(128) 评论(0) 推荐(0) 编辑
摘要: typedef struct { int Data[10000]; int top1; int top2; } CQueue; CQueue* cQueueCreate() { CQueue *newQueue = (CQueue *)malloc(sizeof(CQueue)); newQueue 阅读全文
posted @ 2020-08-19 12:31 温暖了寂寞 阅读(82) 评论(0) 推荐(0) 编辑
摘要: char* reverseWords(char* s){ int len = strlen(s); int count = 0; //单词数量 如果只有一个 头部不加空格 int len_word = 0; //单词长度包括标点符号 char* str = (char*)malloc(len+1); 阅读全文
posted @ 2020-08-18 19:06 温暖了寂寞 阅读(165) 评论(0) 推荐(0) 编辑
上一页 1 ··· 51 52 53 54 55 56 57 58 59 ··· 63 下一页