/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* partition(ListNode* head, int x) {
ListNode left(0),right(0);
ListNode*l=&left,*r=&right;
while(head){
ListNode*&ref=head->val < x ? l:r;
ref->next=head;
ref=ref->next;
head=head->next;
}
l->next=right.next;
r->next=NULL;
return left.next;
}
};
本文地址:https://blog.csdn.net/l_c_c_c/article/details/107291260
如对本文有疑问, 点击进行留言回复!!
clion+vs编译器+Qt5中使用QPrinter和QprintDialog类
基于open62541在QT编写OPCUA特定的客户端程序(含有源码) + VS2015 C语言搭建OPCUA客户端环境
网友评论