
链表
文章平均质量分 61
stefanharden
这个作者很懒,什么都没留下…
展开
-
Add Two Numbers 链表相加
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 16:33:44 · 467 阅读 · 0 评论 -
Reverse Linked List II 翻转链表II
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 16:42:54 · 394 阅读 · 0 评论 -
Rotate List 旋转链表
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 17:06:01 · 394 阅读 · 0 评论 -
Remove Duplicates from Sorted List 删除链表中的重复元素,保留一次
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 16:56:57 · 415 阅读 · 0 评论 -
Reverse Nodes in k-Group k个数为一组翻转结点
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 19:32:20 · 362 阅读 · 0 评论 -
Remove Duplicates from Sorted List II 删除链表中的元素(不保留重复)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 17:00:31 · 531 阅读 · 0 评论 -
Partition List 分割链表
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 16:48:41 · 460 阅读 · 0 评论 -
LRU Cache 最近最少使用缓存的设计
class LRUCache{public: LRUCache(int capacity) { cap=capacity; head=new ListNode(0,0); tail=new ListNode(0,0); head->left=NULL; head->right=tail;原创 2014-01-19 19:50:49 · 533 阅读 · 0 评论 -
Reorder List 重排链表
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:原创 2014-01-19 19:45:18 · 409 阅读 · 0 评论 -
Linked List Cycle II 链表环的入口
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: bo原创 2014-01-19 19:41:42 · 432 阅读 · 0 评论 -
Linked List Cycle 链表是否有环
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: bo原创 2014-01-19 19:38:53 · 351 阅读 · 0 评论 -
Swap Nodes in Pairs 成对交换结点
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 19:25:40 · 356 阅读 · 0 评论 -
Remove Nth Node From End of List 删除链表的倒数第n个结点
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 17:09:19 · 446 阅读 · 0 评论 -
Copy List with Random Pointer 带随机指针链表的复制
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: Li原创 2014-01-19 19:34:39 · 398 阅读 · 0 评论