llllmz

导航

上一页 1 2 3 4 5 6 7 8 9 ··· 30 下一页

2024年3月19日

142. 环形链表 II

摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode *detectCycle(struct ListNode 阅读全文

posted @ 2024-03-19 15:54 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

76. 最小覆盖子串c

摘要: bool judge(int* s,int* t){ for(int i=0;i<200;i++){ if(s[i]<t[i]) return false; } return true; } char* minWindow(char* s, char* t) { int ns=strlen(s),n 阅读全文

posted @ 2024-03-19 15:51 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0) 编辑

2024年3月18日

904. 水果成篮c

摘要: int totalFruit(int* fruits, int fruitsSize) { int lanzi[2]={-1,-1}; if(fruitsSize<=2) return fruitsSize; int max=0,count=0; int head=0,tail=0; while(t 阅读全文

posted @ 2024-03-18 19:07 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

209. 长度最小的子数组c

摘要: int minSubArrayLen(int target, int* nums, int numsSize) { int head=0,tail=0,sum=nums[0]; long min=LONG_MAX; while(tail<numsSize){ if(sum>=target){ if( 阅读全文

posted @ 2024-03-18 17:23 神奇的萝卜丝 阅读(3) 评论(0) 推荐(0) 编辑

844. 比较含退格的字符串c

摘要: bool backspaceCompare(char* s, char* t) { int ns=strlen(s),nt=strlen(t); int heads=0,headt=0,index=0; while(index<ns){ if(s[index]!='#'){ s[heads++]=s 阅读全文

posted @ 2024-03-18 17:12 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0) 编辑

26. 删除有序数组中的重复项c

摘要: int removeDuplicates(int* nums, int numsSize) { int head=0,index=0; while(index<numsSize){ if(index!=0 && nums[index]!=nums[index-1]){ nums[head++]=nu 阅读全文

posted @ 2024-03-18 17:05 神奇的萝卜丝 阅读(4) 评论(0) 推荐(0) 编辑

367. 有效的完全平方数c

摘要: bool isPerfectSquare(int num) { if(num==1) return true; int head=0,tail=num-1; while(head<=tail){ int mid=head+(tail-head)/2; long long temp=pow(mid,2 阅读全文

posted @ 2024-03-18 16:58 神奇的萝卜丝 阅读(0) 评论(0) 推荐(0) 编辑

35. 搜索插入位置c

摘要: int searchInsert(int* nums, int numsSize, int target) { int head=0,tail=numsSize-1; while(head<=tail){ int mid=head+(tail-head)/2; if(nums[mid]==targe 阅读全文

posted @ 2024-03-18 16:53 神奇的萝卜丝 阅读(0) 评论(0) 推荐(0) 编辑

438. 找到字符串中所有字母异位词c

摘要: /** * Note: The returned array must be malloced, assume caller calls free(). */ bool judge(int* a,int* b){ for(int i=0;i<27;i++){ if(a[i]<b[i]) return 阅读全文

posted @ 2024-03-18 16:50 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

15. 三数之和c

摘要: /** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * Note: Both returned array a 阅读全文

posted @ 2024-03-18 16:27 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 30 下一页