2015年10月17日

Reverse Nodes in k-Group

摘要: 1 class Solution { 2 public: 3 ListNode* reverseKGroup(ListNode* head, int k) { 4 if(head==NULL||knext;16 17 ... 阅读全文

posted @ 2015-10-17 16:17 RenewDo 阅读(112) 评论(0) 推荐(0) 编辑

Swap Nodes in Pairs

摘要: 1 class Solution { 2 public: 3 ListNode* swapPairs(ListNode* head) { 4 if(head==NULL||head->next==NULL) return head; 5 ListNode p... 阅读全文

posted @ 2015-10-17 15:18 RenewDo 阅读(124) 评论(0) 推荐(0) 编辑

Remove Nth Node From End of List

摘要: 效率不高,还是以前的思路,没有创新,下面是别人的一个比较好的 凡是说倒着第几个都可以利用顺着的第几个打个标记,然后另一个从头开始,这个继续直到这个到结尾。 阅读全文

posted @ 2015-10-17 14:50 RenewDo 阅读(116) 评论(0) 推荐(0) 编辑

2015年10月16日

Rotate List

摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne... 阅读全文

posted @ 2015-10-16 20:15 RenewDo 阅读(136) 评论(0) 推荐(0) 编辑

Remove Duplicates from Sorted List

摘要: 1 class Solution { 2 public: 3 ListNode* deleteDuplicates(ListNode* head) { 4 ListNode prehead(0); 5 prehead.next=head; 6 ... 阅读全文

posted @ 2015-10-16 19:28 RenewDo 阅读(130) 评论(0) 推荐(0) 编辑

Reverse Linked List II

摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne... 阅读全文

posted @ 2015-10-16 19:18 RenewDo 阅读(122) 评论(0) 推荐(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) {} * }; *... 阅读全文

posted @ 2015-10-16 18:42 RenewDo 阅读(123) 评论(0) 推荐(0) 编辑

Partition List

摘要: 1 class Solution { 2 public: 3 ListNode* partition(ListNode* head, int x) { 4 // ListNode *node1,* node2; 5 ListNode *node1,*node2; 6 ... 阅读全文

posted @ 2015-10-16 14:21 RenewDo 阅读(190) 评论(0) 推荐(0) 编辑

2015年10月7日

iterator指针指向的元素

摘要: class rectangle{public: conner left_bottle; // 为了计算方便,把几个点都列出 int width; // 宽度 int height; // } 一开始 (*it).width没加括号,则优先级就错了,后来是用了->符号也提示错误。(不知道是不是应为定义 阅读全文

posted @ 2015-10-07 22:08 RenewDo 阅读(491) 评论(0) 推荐(0) 编辑

2015年9月28日

Debug Assertion Failed! (VS)

摘要: Debugging question - C++ Forumhttp://www.cplusplus.com/forum/general/92324/一般这种情况都是指针无效解决办法: View image: Debug VC http://postimg.org/image/uch0smgxn/弹... 阅读全文

posted @ 2015-09-28 17:11 RenewDo 阅读(284) 评论(0) 推荐(0) 编辑

导航