Remove Nth Node From End of List
来源:互联网 发布:python安装socket库 编辑:程序博客网 时间:2024/04/30 13:01
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *removeNthFromEnd(ListNode *head, int n) { // Start typing your C/C++ solution below // DO NOT write int main() function ListNode *pre = new ListNode(0); pre->next=head; ListNode *p1=pre,*p2=pre,*ret=NULL; while(n--)p2=p2->next; while(p2->next!=NULL){ p1=p1->next; p2=p2->next; } p1->next=p1->next->next; return pre->next; }};
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node from End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- 【VB.NET2010】在PictureBox上绘制文字的相关问题
- EM 创建/启动 异常(1)
- 自定义消息的发送与响应:
- GNU 网站地址
- eclipse axis2 plugins 安装与使用
- Remove Nth Node From End of List
- 写得蛮好的linux学习笔记
- 编程瑕想:面向结构、面向对象、面向线程-->基于类库重用的面向应用软件开发
- 页游AS客户端架构设计历程记录
- uva 10891 - Game of Sum(博弈,区间dp)
- YUM 学习
- webservice开源引擎的比较:Axis和CXF的比较
- poj 1384 && hdu 1114 Piggy-Bank (完全背包)
- ADO.NET三个经典案例