摘要:
http://oj.leetcode.com/problems/partition-list/链表的处理#include using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution {public: ListNode *partition(ListNode *head, int x) { ListNode *head1 = NULL,*head2 = NULL,*tai...
阅读全文
posted @ 2014-02-13 22:17
qingcheng奕
阅读(144)
推荐(0)
摘要:
http://oj.leetcode.com/problems/reverse-linked-list-ii/链表的操作#include using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; class Solution {public: ListNode *reverseBetween(ListNode *head, int m, int n) { ListNode dummy(-1); ...
阅读全文
posted @ 2014-02-13 17:57
qingcheng奕
阅读(143)
推荐(0)
摘要:
http://oj.leetcode.com/problems/3sum/找出三个数的和是0的元组.class Solution {public: vector > threeSum(vector &num) { vector > ans; if(num.size()0) break; if(num[i]+num[j]+num[num.size()-1] onePiece; onePiece.push_back(num[...
阅读全文
posted @ 2014-02-13 13:27
qingcheng奕
阅读(321)
推荐(0)