LeetCode_copy-list-with-random-pointer
来源:互联网 发布:ae cc2018 for mac 编辑:程序博客网 时间:2024/06/06 01:29
/** * Definition for singly-linked list with a random pointer. * class RandomListNode { * int label; * RandomListNode next, random; * RandomListNode(int x) { this.label = x; } * }; */public class Solution { public RandomListNode copyRandomList(RandomListNode head) {if(head==null){return null;} RandomListNode head_copy= new RandomListNode(head.label); RandomListNode head_con=head,head_copy_con=head_copy;while(head_con.next!=null){head_copy_con.next=new RandomListNode(head_con.next.label);head_copy_con=head_copy_con.next;head_con=head_con.next;}head_copy_con.next=null;head_con=head;head_copy_con=head_copy;while(head_con.next!=null){head_copy_con.random=head_con.random;head_copy_con=head_copy_con.next;head_con=head_con.next;} head_copy_con.random=head_con.random;return head_copy;}}
阅读全文
0 0
- LeetCode_Copy List with Random Pointer
- leetcode_Copy List with Random Pointer
- LeetCode_copy-list-with-random-pointer
- **Leetcode_copy-list-with-random-pointer (c++ and python version)
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- Copy List with Random Pointer
- jsp 入门配置
- nginx的安装
- HTML学习—表单
- 用VS2013生成和调用DLL库 for OpenCV
- 数码相机中的ISO
- LeetCode_copy-list-with-random-pointer
- MySQL 和jdbc
- SSD5 数据结构 Course Design Exercise 4 解析
- 关于CSV文件格式中的换行问题
- php导出excel最简单的办法,无需phpexcel
- 冒泡排序、二分法查找基于Java的简单实现
- SQLAlchemy 一些基本操作
- 绝对详解PHP 的imageTtfText()函数
- laravel框架-设置中间件middleware报错,提示Route[login] not defined问题