llllmz

导航

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

2024年3月18日

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 神奇的萝卜丝 阅读(17) 评论(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 神奇的萝卜丝 阅读(13) 评论(0) 推荐(0)

283. 移动零c

摘要: void moveZeroes(int* nums, int numsSize) { int head=0,index=0; while(index<numsSize){ if(nums[index]!=0){ nums[head++]=nums[index]; } index++; } for(; 阅读全文

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

2024年3月17日

459. 重复的子字符串c

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

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

46. 携带研究材料(第六期模拟笔试)

摘要: #include<stdio.h> #include<stdlib.h> int max(int i,int j){ if(i>j) return i; return j; } int main(){ int m,n; scanf("%d %d\n",&m,&n); int* value=(int* 阅读全文

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

96. 不同的二叉搜索树c

摘要: int numTrees(int n) { int* dp=(int*)malloc(sizeof(int)*(n+4)); for(int i=0;i<n+4;i++) dp[i]=0; dp[0]=1,dp[1]=1,dp[2]=2; for(int i=3;i<=n;i++){ for(int 阅读全文

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

63. 不同路径 IIc

摘要: int uniquePathsWithObstacles(int** obstacleGrid, int obstacleGridSize, int* obstacleGridColSize) { if(obstacleGridSize==0) return 0; int m=obstacleGri 阅读全文

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

62. 不同路径c

摘要: int uniquePaths(int m, int n) { int** dp=(int**)malloc(sizeof(int*)*m); for(int i=0;i<m;i++) dp[i]=(int*)malloc(sizeof(int)*n); for(int i=0;i<m;i++) d 阅读全文

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

70. 爬楼梯c

摘要: int climbStairs(int n) { int* dp=(int*)malloc(sizeof(int)*(n+4)); dp[0]=1,dp[1]=1; for(int i=2;i<=n;i++){ dp[i]=dp[i-1]+dp[i-2]; } return dp[n]; } 阅读全文

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

509. 斐波那契数c

摘要: int fib(int n){ int* dp=(int*)malloc(sizeof(int)*(n+4)); dp[0]=0,dp[1]=1; for(int i=2;i<=n;i++){ dp[i]=dp[i-1]+dp[i-2]; } return dp[n]; } 阅读全文

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

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