[Leetcode] Partition List **
来源:互联网 发布:威廉马歇尔 知乎 编辑:程序博客网 时间:2024/05/11 05:27
/** * 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) { // Start typing your C/C++ solution below // DO NOT write int main() function ListNode* pL = NULL; ListNode* pR = NULL; ListNode* pLastR = NULL; ListNode** ppL = &pL; ListNode** ppR = &pR; while (head) { if (head->val < x) { *ppL = head; ppL = &(head->next); } else { *ppR = head; pLastR = head; ppR = &(head->next); } head = head->next; } *ppL = pR; if (pLastR) pLastR->next = NULL; return pL; }};
- LeetCode: Partition List
- LeetCode Partition List
- LeetCode: Partition List
- [Leetcode] Partition List **
- [Leetcode] Partition List
- [LeetCode] Partition List
- leetcode 81: Partition List
- [Leetcode] Partition List
- leetcode 118: Partition List
- [LeetCode]Partition List
- [leetcode]Partition List
- LeetCode-Partition List
- [leetcode] Partition List
- LeetCode - Partition List
- [LeetCode] Partition List
- LeetCode 86: Partition List
- LeetCode:Partition List
- 【leetcode】Partition List
- 按照Json格式读取Mongodb中数据
- Android触摸屏输入系统
- 自定义分页控件
- hibernate4与hibernate3的区别
- try-finally语句
- [Leetcode] Partition List **
- Oracle 11g 新特性 -- Transparent Data Encryption (透明数据加密TDE) 增强 说明
- 23种设计模式之工厂方法模式
- 反编译问题
- bash shell (4) linux bg fg 命令
- linux 内核调试方法
- Drupal 7: Views Slideshow Tutorial Drupal 7 :Views Slideshow 模块教程
- php位运算
- lpc1788的地址空间分配