llllmz

导航

上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 35 下一页

2024年3月13日

76. 最小覆盖子串c

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

posted @ 2024-03-13 15:24 神奇的萝卜丝 阅读(21) 评论(0) 推荐(0)

904. 水果成篮c

摘要: typedef struct node{ int fruit; int lastindex; }node; int totalFruit(int* fruits, int fruitsSize) { node f[2]; f[0].fruit=-1,f[1].fruit=-1; int max=0, 阅读全文

posted @ 2024-03-13 14:34 神奇的萝卜丝 阅读(2) 评论(0) 推荐(0)

209. 长度最小的子数组c

摘要: int minSubArrayLen(int target, int* nums, int numsSize) { int sum=nums[0],head=0,tail=0,min=INT_MAX; int t=0; for(int i=0;i<numsSize;i++){ t+=nums[i]; 阅读全文

posted @ 2024-03-13 14:12 神奇的萝卜丝 阅读(8) 评论(0) 推荐(0)

2024年3月12日

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

摘要: bool backspaceCompare(char* s, char* t) { int ns=strlen(s),nt=strlen(t); int head=0,tail=0; int n1=0,n2=0; while(tail<ns){ if(head==0&&s[tail]=='#'){ 阅读全文

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

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

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

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

367. 有效的完全平方数c

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

posted @ 2024-03-12 20:21 神奇的萝卜丝 阅读(6) 评论(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)/2; if(nums[mid] < target){ 阅读全文

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

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

摘要: /** * Note: The returned array must be malloced, assume caller calls free(). */ int change(char c){ return c-'a'; } bool judge(char* s,int head,int ta 阅读全文

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

15. 三数之和c

摘要: 回溯写了个超时了。这里写得树层去重还是值得借鉴得。 /** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * N 阅读全文

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

11. 盛最多水的容器c

摘要: int maxArea(int* height, int heightSize) { int max=0; int head=0,tail=heightSize-1; while(head<tail){ int sum; if(height[head]<height[tail]){ sum=heig 阅读全文

posted @ 2024-03-12 15:11 神奇的萝卜丝 阅读(7) 评论(0) 推荐(0)

上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 35 下一页