llllmz

导航

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 35 下一页

2024年3月19日

459. 重复的子字符串c

摘要: void build(int* next,char* s,int n){ next[0]=-1; int index=1,j=-1; while(index<n){ if(j 1 || s[index-1] == s[j]){ j++; next[index++]=j; }else{ j=next[ 阅读全文

posted @ 2024-03-19 16:22 神奇的萝卜丝 阅读(16) 评论(0) 推荐(0)

28. 找出字符串中第一个匹配项的下标c

摘要: void bulid(int* next,char* s,int n){ next[0]=-1; int index=1,j=-1; while(index<n){ if(j 1 || s[index-1] ==s[j] ){ j++; next[index++]=j; }else{ j=next[ 阅读全文

posted @ 2024-03-19 16:08 神奇的萝卜丝 阅读(13) 评论(0) 推荐(0)

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 神奇的萝卜丝 阅读(12) 评论(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 神奇的萝卜丝 阅读(11) 评论(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 神奇的萝卜丝 阅读(11) 评论(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 神奇的萝卜丝 阅读(12) 评论(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 神奇的萝卜丝 阅读(8) 评论(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 神奇的萝卜丝 阅读(14) 评论(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 神奇的萝卜丝 阅读(5) 评论(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 神奇的萝卜丝 阅读(12) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 35 下一页