- 博客(3)
- 资源 (1)
- 收藏
- 关注
原创 leetcode 92. Reverse Linked List II
反转指定两个位置之间的树。ListNode *reverseBetween(ListNode *head, int m, int n) { if(m==n)return head; n-=m; ListNode prehead(0); prehead.next=head; ListNode* pre=&prehead; while(--m)pre=pr
2017-02-28 21:14:10 331
原创 leetcode 84 Remove Duplicates from Sorted List II
删除一个链表里面重复出现过的元素。 11123 -〉 23自己的思路:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class
2017-02-28 16:03:42 329
原创 leetcode 41 finding missing positive
找到数组中第一个消失的正整数。先桶排序,将值为i的数和第 i-1 位 交换,然后遍历数组找到第一个值不等于位置 +1 的即可。class Solution { public: int firstMissingPositive(vector<int>& nums) { int l=nums.size(); for(int i=0;i<l;i++){
2017-02-27 20:41:47 260
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人