llllmz

导航

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 神奇的萝卜丝 阅读(8) 评论(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 神奇的萝卜丝 阅读(10) 评论(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 神奇的萝卜丝 阅读(16) 评论(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 神奇的萝卜丝 阅读(12) 评论(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 神奇的萝卜丝 阅读(12) 评论(0) 推荐(0)

225. 用队列实现栈 c

摘要: typedef struct { int a[100]; int top; int size; } MyStack; MyStack* myStackCreate() { MyStack* stack=(MyStack*)malloc(sizeof(MyStack)); stack->top=0; 阅读全文

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

232. 用栈实现队列 C

摘要: C用数组模拟即可 typedef struct { int a[100]; int front; int tail; int size; } MyQueue; MyQueue* myQueueCreate() { MyQueue* q=(MyQueue*)malloc(sizeof(MyQueue) 阅读全文

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

459. 重复的子字符串 c

摘要: bool repeatedSubstringPattern(char* s) { int ns=0; while(s[ns]!=0) ns++; if(ns<=1) return false; bool same =true; char temp=s[0]; int i=1; for(;i<ns;i 阅读全文

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

55. 右旋字符串 C

摘要: #include<stdio.h> void reverse(char* s,int head,int tail){ while(head<=tail){ char temp=s[head]; s[head]=s[tail]; s[tail]=temp; head++; tail--; } } ch 阅读全文

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

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

摘要: 现在解决一个中等难度的题得要30min,争取在复试的时候提升到只有15min!!!! void revesestring(char* s,int head,int tail){ while(head<=tail){ char temp=s[head]; s[head]=s[tail]; s[tail 阅读全文

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

54. 替换数字 C

摘要: #include<stdio.h> int main(){ char c[10000]; scanf("%s",c); int i=0; while(c[i]!=0){ int t=c[i]-'0'; if(0<=t&&t<=9){ printf("number"); }else{ printf(" 阅读全文

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

541. 反转字符串 II C

摘要: void reverse_string(char* s,int head,int tail){ while(head<=tail){ char t=s[head]; s[head]=s[tail]; s[tail]=t; head++; tail--; } } char* reverseStr(ch 阅读全文

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