llllmz

导航

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

2024年3月18日

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 神奇的萝卜丝 阅读(1) 评论(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 神奇的萝卜丝 阅读(1) 评论(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 神奇的萝卜丝 阅读(3) 评论(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 神奇的萝卜丝 阅读(1) 评论(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 神奇的萝卜丝 阅读(1) 评论(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 神奇的萝卜丝 阅读(3) 评论(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 神奇的萝卜丝 阅读(2) 评论(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 神奇的萝卜丝 阅读(1) 评论(0) 推荐(0) 编辑

435. 无重叠区间c

摘要: typedef struct node{ int left; int right; }bounds; int cmp(const void* a,const void* b){ bounds* x=(bounds*)a; bounds* y=(bounds*)b; if(x->right > y-> 阅读全文

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

452. 用最少数量的箭引爆气球c

摘要: typedef struct node{ int left; int right; }bounds; int cmp(const void* a,const void* b){ bounds* x=(bounds*)a; bounds* y=(bounds*)b; if(x->right >y->r 阅读全文

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

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