![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
人生体验
多体验人生
展开
-
leetcode(376)
class Solution {public: int wiggleMaxLength(vector<int>& nums) { if(nums.size()<2){ return nums.size(); } static const int BEGIN = 0; static const int UP = 1; static const int DOWN = 2;.原创 2020-05-20 21:25:18 · 125 阅读 · 0 评论 -
leetcode(295)
class MedianFinder {public: /** initialize your data structure here. */ MedianFinder() { } void addNum(int num) { if(big_queue.empty()){ big_queue.push(num); return; //没有这个 出来的结果都不对 } .原创 2020-05-19 07:36:06 · 140 阅读 · 0 评论 -
leetcode(255)
class MyStack {public: /** Initialize your data structure here. */ MyStack() { } /** Push element x onto stack. */ void push(int x) { std::queue<int> temp_queue; temp_queue.push(x); while(!_data.emp.原创 2020-05-17 15:12:24 · 289 阅读 · 0 评论 -
leetcode (23)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */bool cmp(const ListNode *a,const ListNode *b){ return a->val<b->val;}class Solu.原创 2020-05-17 14:11:51 · 125 阅读 · 0 评论 -
leetcode(21)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { ListN.原创 2020-05-17 09:57:22 · 123 阅读 · 0 评论 -
leetcode (138)
/*// Definition for a Node.class Node {public: int val; Node* next; Node* random; Node(int _val) { val = _val; next = NULL; random = NULL; }};*///这里使用stl 的map 来实现class Solution {public: Node* co.原创 2020-05-17 09:34:20 · 119 阅读 · 0 评论 -
leetcode (86)
/** * 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) { //value .原创 2020-05-17 09:09:00 · 161 阅读 · 0 评论 -
leetcode(142)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode *detectCycle(ListNode *head) { std::set<ListNod.原创 2020-05-16 09:23:42 · 174 阅读 · 0 评论 -
leetcode(160)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ //使用stl 的setclass Solution {public: ListNode *getIntersectionNode(ListNode *headA, ListNo.原创 2020-05-16 08:11:09 · 109 阅读 · 0 评论 -
leetcode(92)
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* reverseBetween(ListNode* head, int m, int n) { in.原创 2020-05-15 17:53:58 · 114 阅读 · 0 评论