摘要:/** * Definition for singly-linked list with a random pointer. * struct RandomListNode { * int label; * RandomListNode *next, *random; * RandomListNod
阅读全文
posted @ 2018-02-12 12:44
|
|
|
随笔分类 - LeetCode
摘要:/** * Definition for singly-linked list with a random pointer. * struct RandomListNode { * int label; * RandomListNode *next, *random; * RandomListNod
阅读全文
posted @ 2018-02-12 12:44
摘要:建立了两个ListNode变量已经两个ListNode*指针 遍历链表 将小于x值的连入一条链 将大于x值得连入一条链 最后将这两条链相连 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNo
阅读全文
posted @ 2018-02-11 12:32
摘要:法一!!!利用set集合 环中的元素依次遍历 原集合有就返回 原集合没有就插入 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) :
阅读全文
posted @ 2018-02-09 11:15
摘要:法一 邦邦邦~~~~~~~ 思想比较简单 运用了c++中的STL的set set这个东西详见此博客http://www.cnblogs.com/BeyondAnyTime/archive/2012/08/13/2636375.html 通过比较每个ListNode的地址,地址相同即开始相交,(注意:
阅读全文
posted @ 2018-02-02 19:45
摘要:/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */class Solution { p
阅读全文
posted @ 2018-02-01 20:53
摘要:首先说一下我的刷题计划和过程,B站有关于leetcode的算法视频,我是边看边刷,有的视频上面有一些代码有错,建议大家还是多多自己判断。 法一 邦邦邦~~~~ 原始链表:① >② >③ >④ >⑤ >null head 摘下一个元素组成新链表: ② >③ >④ >⑤ >null(原始) ↑ head
阅读全文
posted @ 2018-02-01 16:46
|
|