摘要: 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) 编辑
摘要: //头尾指针 int *exchange(int *nums, int numsSize, int *returnSize) { int left = 0; int right = numsSize - 1; while (left < right) { if ((nums[left] % 2) = 阅读全文
posted @ 2020-08-18 16:20 温暖了寂寞 阅读(163) 评论(0) 推荐(0) 编辑
摘要: int* spiralOrder(int** matrix, int matrixSize, int* matrixColSize, int* returnSize){ if(!matrixSize) { *returnSize = 0; return NULL;} *returnSize = ma 阅读全文
posted @ 2020-08-18 16:19 温暖了寂寞 阅读(179) 评论(0) 推荐(0) 编辑
摘要: int maxSubArray(int* nums, int numsSize){ int ans = nums[0]; int curSum = nums[0]; for(int i = 1;i<numsSize;i++){ if((curSum + nums[i]) < nums[i]) //如 阅读全文
posted @ 2020-08-18 14:43 温暖了寂寞 阅读(104) 评论(0) 推荐(0) 编辑
摘要: struct ListNode* getKthFromEnd(struct ListNode* head, int k){ struct ListNode* pNode = head; for (int i = 0; i < k; ++i) { pNode = pNode->next; } whil 阅读全文
posted @ 2020-08-18 12:09 温暖了寂寞 阅读(151) 评论(0) 推荐(0) 编辑