摘要:
二路归并。 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ clas 阅读全文
摘要:
快慢指针。 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ clas 阅读全文
摘要:
双指针。 class Solution { public: vector<int> exchange(vector<int>& nums) { int n = nums.size(); int i = 0, j = n - 1; while (i < j) { while (i < j && num 阅读全文