19. Remove Nth Node From End of List
来源:互联网 发布:浪潮软件官网 编辑:程序博客网 时间:2024/06/05 04:19
public static ListNode removeNthFromEnd(ListNode head, int n) { if(head == null) { return null; } ListNode predel = null,del = null, cur =head; int count = 0; while(cur!=null) { count++; if(del !=null) { predel = del; del = del.next; } if(count == n) { del = head; } if(count == n+1) { predel = head; } cur = cur.next; } if(predel == null && del !=null) { head = head.next; }else if(predel !=null && del !=null) { predel.next = del.next; } return head; }
0 0
- 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
- Python调试
- Hadoop 执行 hdfs namenode -format报错
- 把request对象中的请求参数封装到bean中/生成UUID
- java-归并排序与快排的效率比较
- ubuntu上简单操作(一)
- 19. Remove Nth Node From End of List
- linux使用手册
- WindowManager.LayoutParams详解
- 《数据结构导论之树、二叉树、森林间的转换》
- 记录一道JS笔试题
- 数学训练----数论F - Farey Sequence
- 使用Python从各个子文件夹中复制指定文件的程序
- 51node1476 括号序列的最小代价(贪心)
- 神经网络weight参数怎么初始化