LeetCode
禄潜
这个作者很懒,什么都没留下…
展开
-
反转链表
之前在C语言数据结构(1)——线性表一文中介绍了链表及其一些常见的操作,这次介绍一下链表的反转操作。 头插法 struct ListNode* reverseList(struct ListNode* head){ struct ListNode*output=(struct ListNode*)malloc(sizeof(struct ListNode)); struct Lis...原创 2020-04-29 21:54:58 · 130 阅读 · 0 评论 -
LeetCode 237. 删除链表中的节点
void deleteNode(struct ListNode* node) { node->val = node->next->val; node->next = node->next->next; }原创 2020-04-29 15:00:21 · 149 阅读 · 0 评论 -
LeetCode 771. 宝石与石头
int numJewelsInStones(char * J, char * S){ int count=0; char*temp=J; for(;*S!='\0';S++) { for(;*J!='\0';J++) { if(*S==*J) count++; } J=temp;...原创 2020-04-29 10:23:18 · 143 阅读 · 0 评论 -
LeetCode 1295. 统计位数为偶数的数字
int findNumbers(int* nums, int numsSize){ int count=0; for(int i=0;i<numsSize;i++) { if(nums[i]>=10&&nums[i]<100) count++; if(nums[i]>=1000&&num...原创 2020-04-29 10:17:46 · 150 阅读 · 0 评论