86. Partition List
来源:互联网 发布:linux执行文件命令 编辑:程序博客网 时间:2024/06/14 11:50
class Solution {public: ListNode* partition(ListNode* head, int x) { if(!head||!head->next) return head; ListNode *less=NULL; ListNode *more=NULL; ListNode *morehead=NULL; ListNode *lesshead=NULL; while(head) { if(head->val<x) { if(!less) { less = head; lesshead=head; head=head->next; } else { less->next=head; less=less->next; head=head->next; } } else { if(!more) { more=head; morehead=head; head=head->next; } else { more->next=head; more=more->next; head=head->next; } } } if(!morehead) return lesshead; else if(!lesshead) return morehead; more->next=NULL; less->next=morehead; return lesshead; }};
0 0
- [LeetCode]86.Partition List
- LeetCode 86. Partition List
- [Leetcode] 86. Partition List
- LeetCode --- 86. Partition List
- 86. Partition List
- [leetcode] 86.Partition List
- [leetcode] 86. Partition List
- 86. Partition List
- [LeetCode]86. Partition List
- 86. Partition List
- 86. Partition List LeetCode
- 86. Partition List
- 86. Partition List
- 86. Partition List
- Leetcode 86. Partition List
- LeetCode *** 86. Partition List
- LeetCode 86. Partition List
- [LeetCode]86. Partition List
- CUDA中一些error的解决方法
- html字体大小em
- JavaScript Date对象
- RDD原理与详解
- 引用(五)
- 86. Partition List
- php设计模式 抽象工厂模式
- 用Swagger调用Harbor Registry的REST API
- 理解图像的傅里叶变换(细心分析)
- Linux安装其他版本GCC的方法
- php namespace
- 103. Binary Tree Zigzag Level Order Traversal
- 李菲菲课程笔记:Deep Learning for Computer Vision – Introduction to Convolution Neural Networks
- Android应用Design Support Library 使用研究