[leetcode] Copy List with Random Pointer, Java
来源:互联网 发布:中文波斯语翻译软件 编辑:程序博客网 时间:2024/06/02 06:34
public RandomListNode copyRandomList(RandomListNode head) { if(head == null) return null; RandomListNode p = head;while(p != null){RandomListNode tmp = new RandomListNode(p.label);tmp.next = p.next;p.next = tmp;p = p.next.next;}p = head;while(p != null){p.next.random = (p.random == null ? null : p.random.next);p = p.next.next;}RandomListNode copy = head.next;p = head;while(p != null){RandomListNode tmp = p.next;p.next = p.next.next;tmp.next = (tmp.next == null ? null : tmp.next.next);p = p.next;}return copy; }
0 0
- [Leetcode] Copy List with Random Pointer (Java)
- [leetcode] Copy List with Random Pointer, Java
- Copy List with random pointer--Leetcode(Java)
- Copy List with Random Pointer leetcode java
- [leetcode][list] Copy List with Random Pointer
- [leetcode-138]Copy List with Random Pointer(java)
- [LeetCode] 138. Copy List with Random Pointer java
- [leetcode]138. Copy List with Random Pointer@Java解题报告
- Leetcode: Copy List with Random Pointer
- LeetCode: Copy List with Random Pointer
- [LeetCode] Copy List with Random Pointer
- [leetcode]Copy List with Random Pointer
- LeetCode:Copy List with Random Pointer
- leetcode Copy List with Random Pointer
- LeetCode:Copy List with Random Pointer
- LeetCode题解:Copy List with Random Pointer
- [LeetCode]Copy List with Random Pointer
- leetcode Copy List with Random Pointer
- 1-2 输出N个数的平方和立方值
- Unable to load configuration. - bean - jar
- Cocos2d-x 屏幕适配详解
- 《C++Primer》学习笔记(11-12章)
- Oracle表空间数据文件转移方法
- [leetcode] Copy List with Random Pointer, Java
- Spring3.x--注入Bean属性
- 转来的,我每次看都有收获
- Gas Station
- 修改名字对话框的实现
- C#中如何去除窗体默认的关闭按钮
- Partition List
- JS获取当前时间
- 安卓开发工具安卓