Leetcode_19
来源:互联网 发布:socket编程是什么意思 编辑:程序博客网 时间:2024/06/06 00:24
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* removeNthFromEnd(struct ListNode* head, int n) { int count = 0; int count_1 = 0; struct ListNode* node = head; while(node){ ++ count; node = node->next; } if(count < n) return head; if(count == n){ head = head->next; return head; } node = head; while(node){ ++count_1; if(count - count_1 == n){ break; } node = node->next; } node->next = node->next->next; return head; }
0 0
- Leetcode_19
- LeetCode_19、100两题
- LeetCode_19---Remove Nth Node From End of List
- Leetcode_19:Remove Nth Node From End of List
- leetcode_19. Remove Nth Node From End of List 删除单链表中的倒数第n个节点,双指针法
- jQuery 之 (三)事件绑定、动画效果、封闭ajax、三级联动、插件
- 有关service
- 集群与分布式的区别
- LeetCode 11. Container With Most Water
- 单个参数在线调试
- Leetcode_19
- HttpUrlConnection和HttpClient
- 【读书笔记】《Effective Java》(3)-- 类和接口
- bzoj1033: [ZJOI2008]杀蚂蚁antbuster
- about wsgi
- 关于约瑟夫环的思考(三) c++
- Flask-sqlalchemy中的lazy的解释
- 加解密、签名基础理解二
- 利用grub引导多系统debian8.0+win7+ubuntu16.04