![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode。。。碰巧通过
john_and_betty
这个作者很懒,什么都没留下…
展开
-
Remove Duplicates from Sorted List II
class Solution { public: ListNode *deleteDuplicates(ListNode *head) { ListNode dummy(-1); ListNode *ph=&dummy; ph->next=head; ListNode *p,*qpre,*q,*qnext; w原创 2014-03-12 19:55:48 · 391 阅读 · 0 评论 -
Flatten Binary Tree to Linked List
class Solution { public: TreeNode * preorder(TreeNode *root) { if(root==NULL) return NULL; TreeNode *p=preorder(root->left),*q; if(p!=NULL) { Tre原创 2014-03-08 15:25:02 · 333 阅读 · 0 评论 -
Rotate List
class Solution { public: ListNode *rotateRight(ListNode *head, int k) { if(head==NULL) return NULL; ListNode *p,*q,*qpre,*end; q=p=head; int count=0; while(p!=NULL原创 2014-03-08 14:13:18 · 380 阅读 · 0 评论 -
Add Binary
总是犯无脑的错误,没返回结果,字符串转数字没减‘0’,进位的关系没搞清楚,提交了无数次才通过 class Solution { public: string addBinary(string a, string b) { string res; int lena=a.size()-1; int lenb=b.size()-1;原创 2014-03-12 19:34:00 · 353 阅读 · 0 评论 -
Binary Tree Level Order Traversal II
class Solution { public: vector > levelOrderBottom(TreeNode *root) { vector path; vectorpath_val; vector> res; if(root==NULL) return res; path.p原创 2014-03-16 13:33:54 · 343 阅读 · 0 评论