llllmz

导航

上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 35 下一页

2024年3月13日

LCR 159. 库存管理 IIIc

摘要: 经典快排 /** * Note: The returned array must be malloced, assume caller calls free(). */ int divide(int* a,int head,int tail){ int t=a[head]; while(head<t 阅读全文

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

1089. 复写零c

摘要: void duplicateZeros(int* arr, int arrSize) { int* temp=(int*)malloc(sizeof(int)*arrSize); int head=0,index=0; while(head<arrSize && index<arrSize){ te 阅读全文

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

88. 合并两个有序数组c

摘要: 还有什么比刷简单题更爽的。 int cmp(const void* a,const void* b){ return *(int*)a-*(int*)b; } void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size 阅读全文

posted @ 2024-03-13 22:53 神奇的萝卜丝 阅读(9) 评论(0) 推荐(0)

111. 二叉树的最小深度c

摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ int min(int i,int j 阅读全文

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

559. N 叉树的最大深度c

摘要: /** * Definition for a Node. * struct Node { * int val; * int numChildren; * struct Node** children; * }; */ int maxDepth(struct Node* root) { if(!roo 阅读全文

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

347. 前 K 个高频元素C

摘要: /** * Note: The returned array must be malloced, assume caller calls free(). */ typedef struct node{ int num; int count; }Hash; void inset(Hash* hash, 阅读全文

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

239. 滑动窗口最大值c

摘要: C语言没有优先队列库,如果自己实现的话在考试是不现实的。优先使用暴力简单的方法加稍微优化尽可能多的过例子。 /** * Note: The returned array must be malloced, assume caller calls free(). */ int findmax(int* 阅读全文

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

150. 逆波兰表达式求值c

摘要: int cmp(int a,int b,char c){ if(c=='+') return a+b; if(c=='-') return a-b; if(c=='*') return a*b; return a/b; } int evalRPN(char** tokens, int tokensS 阅读全文

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

28. 找出字符串中第一个匹配项的下标c

摘要: KMP! void buildnext(int* next,char* s){ int n=strlen(s); for(int i=0;i<n;i++){ next[i]=pre(s,i); printf("%d ",next[i]); } } int pre(char* s,int head){ 阅读全文

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

142. 环形链表 IIc

摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode *detectCycle(struct ListNode 阅读全文

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

上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 35 下一页