llllmz

导航

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 35 下一页

2024年2月28日

59. 螺旋矩阵 IIC

摘要: /** * 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-02-28 13:30 神奇的萝卜丝 阅读(8) 评论(0) 推荐(0)

2024年2月27日

76. 最小覆盖子串C

摘要: int hash(char c){ return c-'A'+1; } bool judge_Same(int a[],int b[]){ for(int i=0;i<200;i++){ if(b[i]!=0 && b[i]>a[i]) return false; } return true ; } 阅读全文

posted @ 2024-02-27 21:18 神奇的萝卜丝 阅读(28) 评论(0) 推荐(0)

904. 水果成篮C

摘要: int totalFruit(int* fruits, int fruitsSize) { if(fruitsSize<=2) return fruitsSize; int a[2]={-1,-1};//蓝子空 int max=0,n=1; int head=0, tail=0;//从head摘到t 阅读全文

posted @ 2024-02-27 16:14 神奇的萝卜丝 阅读(16) 评论(0) 推荐(0)

209. 长度最小的子数组C

摘要: 滑动窗口的妙用!! int minSubArrayLen(int target, int* nums, int numsSize) { int sum=nums[0];//区间head到tail的和 int head=0,tail=0; int minn=numsSize; int tag=0; i 阅读全文

posted @ 2024-02-27 15:04 神奇的萝卜丝 阅读(10) 评论(0) 推荐(0)

977. 有序数组的平方

摘要: 学习了下用qsort解决。 /** * Note: The returned array must be malloced, assume caller calls free(). */ int cmp(const void* a,const void* b){ return *(int*)a-*( 阅读全文

posted @ 2024-02-27 13:39 神奇的萝卜丝 阅读(11) 评论(0) 推荐(0)

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

摘要: 这题学到了很多。 malloc后要初始化。 申请字符串要N+1个单位 字符串以0结尾等等 char* final(char* s,int n){ char* tem=(char*)malloc(sizeof(char)*(n+1)); for(int i=0;i<=n;i++) { tem[i] = 阅读全文

posted @ 2024-02-27 13:15 神奇的萝卜丝 阅读(18) 评论(0) 推荐(0)

2024年2月26日

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

摘要: int removeDuplicates(int* nums, int numsSize) { if(numsSize==0||numsSize==1) return numsSize; int i=0,j=0; int pre=-999,n=0; while(j<numsSize){ if(num 阅读全文

posted @ 2024-02-26 19:35 神奇的萝卜丝 阅读(14) 评论(0) 推荐(0)

367. 有效的完全平方数C

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

posted @ 2024-02-26 19:18 神奇的萝卜丝 阅读(11) 评论(0) 推荐(0)

69. x 的平方根 C

摘要: int mySqrt(int x) { return sqrt(x); } 阅读全文

posted @ 2024-02-26 19:11 神奇的萝卜丝 阅读(11) 评论(0) 推荐(0)

34. 在排序数组中查找元素的第一个和最后一个位置C

摘要: /** * Note: The returned array must be malloced, assume caller calls free(). */ int* searchRange(int* nums, int numsSize, int target, int* returnSize) 阅读全文

posted @ 2024-02-26 19:08 神奇的萝卜丝 阅读(14) 评论(0) 推荐(0)

上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 35 下一页