llllmz

导航

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

2024年2月29日

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)

2024年2月28日

344. 反转字符串C

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

posted @ 2024-02-28 22:33 神奇的萝卜丝 阅读(6) 评论(0) 推荐(0)

454. 四数相加 II C

摘要: 自己写了一个hash表。 原来学过的数据结构关于hash的那章还是有实际用的,不是书架子。 typedef struct node{ int sum; int count; struct node* repeatnext; }hash; void init_hashtable(hash h[]){ 阅读全文

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

202. 快乐数 C

摘要: 没有意识到这是一个环。 原理就是,其区间是有限的(int型变量存在最大值pow(2,31)-1),而循环却是无限的,那么一定会发生重复的情况。 如果不重复,那么和区间有限矛盾。 int c_sum(int n){ int sum=0; while(n!=0){ int t=n%10; n/=10; 阅读全文

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

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