Remove Nth Node From End of List
来源:互联网 发布:工程宝软件下载 编辑:程序博客网 时间:2024/04/30 09:27
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */public class Solution { public ListNode removeNthFromEnd(ListNode head, int n) { // Start typing your Java solution below // DO NOT write main() function if(head.next==null)return null; ListNode last = head; for(int i = 0; i<n;i++){ last = last.next; } if(last==null)return head.next; ListNode now = head; while(last.next!=null){ last = last.next; now = now.next; } now.next = now.next.next; return head; }}
- 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
- 优化按钮显示效果
- 【Mac上SVN客户端系列】SmartSVN专业版安装、破解及relocate功能使用
- ruby on rails环境搭建
- ExtJS 3 不能在IE9下正常运行的简单解决办法
- 【设计模式】之十九Abstract Factory
- Remove Nth Node From End of List
- Bayer数据的处理
- UpdateData()用于文字框刷新
- 菜鸟学PureMVC记
- const用法
- 用汇编的眼光看C++
- 1.2 初窥输入输出
- C++语言概述
- -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)