86. Partition List
来源:互联网 发布:友贷资本网络贷款 编辑:程序博客网 时间:2024/05/29 07:41
public static ListNode partition(ListNode head, int x) { if(head == null) { return head; } ListNode mhead = null,shead = null,scur =null, mcur = null,cur = head; while(cur != null) { if(cur.val < x) { if(mhead == null) { mhead = cur; mcur = cur; }else { mcur.next = cur; mcur = cur; } }else { if(shead == null) { shead = cur; scur = cur; }else { scur.next = cur; scur = cur; } } cur = cur.next; } if(scur != null) { scur.next =null; } if(mcur != null) { mcur.next = shead; }else { mhead = shead; } return mhead; }
0 0
- [LeetCode]86.Partition List
- LeetCode 86. Partition List
- [Leetcode] 86. Partition List
- LeetCode --- 86. Partition List
- 86. Partition List
- [leetcode] 86.Partition List
- [leetcode] 86. Partition List
- 86. Partition List
- [LeetCode]86. Partition List
- 86. Partition List
- 86. Partition List LeetCode
- 86. Partition List
- 86. Partition List
- 86. Partition List
- Leetcode 86. Partition List
- LeetCode *** 86. Partition List
- LeetCode 86. Partition List
- [LeetCode]86. Partition List
- Bootstrap,随想
- virtualbox ubuntu14.04共享文件夹
- poj 3320
- HDU 5416 dfs
- 基于Qt5.5.0的sql,C++备忘录软件的编写
- 86. Partition List
- Android Service完全解析
- jmeter随笔(13)--jmeter3.0 post body乱码问题
- java基础之注解
- 让Linux流畅你的工作流
- 在vs2013里访问数据库
- 找出ip数据包在网络中经过的路由
- 函数表驱动法
- 《Hadoop学习笔记系列》一.Hadoop基础