llllmz

导航

上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 35 下一页

2024年3月3日

Square c

摘要: 要去寻找所有可能性,典型的dfs问题 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> bool judge(int* temp,int* visit,int noweedge,int length,int n,int nowlengt 阅读全文

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

2024年3月2日

4147:汉诺塔问题(Tower of Hanoi)

摘要: #include<stdio.h> void move(int tail,char now,char tool,char end,int n){//以nown为低,共 n个 if(n <=0) return; move(tail-1,now,end,tool,n-1); printf("%d:%c- 阅读全文

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

2024年3月1日

541. 反转字符串 II

摘要: void reversestring(char* s,int head,int tail){ while(head<=tail){ char temp=s[head]; s[head]=s[tail]; s[tail]=temp; head++; tail--; } } char* reverseS 阅读全文

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

454. 四数相加 II c

摘要: typedef struct node{ int sum; int count; struct node* repeatnext; }hash; void init_hash(hash* h){ for(int i=0;i<128;i++){ h[i].sum=0; h[i].count=0; h[ 阅读全文

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

151. 反转字符串中的单词 c

摘要: void reversestring(char* s,int head,int tail){ while(head<=tail){ char temp=s[head]; s[head]=s[tail]; s[tail]=temp; head++; tail--; } } char* reverseW 阅读全文

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

2024年2月29日

145. 二叉树的后序遍历c

摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * Note: The ret 阅读全文

posted @ 2024-02-29 22:49 神奇的萝卜丝 阅读(13) 评论(0) 推荐(0)

94. 二叉树的中序遍历c

摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * Note: The ret 阅读全文

posted @ 2024-02-29 22:44 神奇的萝卜丝 阅读(12) 评论(0) 推荐(0)

144. 二叉树的前序遍历c

摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * Note: The ret 阅读全文

posted @ 2024-02-29 22:40 神奇的萝卜丝 阅读(24) 评论(0) 推荐(0)

150. 逆波兰表达式求值 C

摘要: int evalRPN(char** tokens, int tokensSize) { int* stack=(int*)malloc(sizeof(int)*tokensSize); for(int i=0;i<tokensSize;i++) stack[i]=0; int top=-1; fo 阅读全文

posted @ 2024-02-29 20:07 神奇的萝卜丝 阅读(13) 评论(0) 推荐(0)

1047. 删除字符串中的所有相邻重复项 c

摘要: char* removeDuplicates(char* s) { int ns=0; while(s[ns]!=0) ns++; if(ns<=1) return s; char* stack=(char*)malloc(sizeof(char)*ns); for(int i=0;i<ns;i++ 阅读全文

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

上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 35 下一页