leetcode
DDDMingo
这个作者很懒,什么都没留下…
展开
-
leetcode-easy前50题整理
7.reverse intergerclass Solution {//beat 97.87%//但是太繁琐了public: int reverse(int x) { int flag,number; if(x==-pow(2,31)) return 0; if(x>...原创 2018-10-12 17:12:33 · 744 阅读 · 0 评论 -
leetcode-explore-Queue&Stack
1.Number of islandsclass Solution {//BFSpublic: int numIslands(vector<vector<char>>& grid) { if(grid.size()==0) return 0; int numisland=0; ...原创 2018-10-30 11:53:54 · 264 阅读 · 0 评论 -
Leetcode-Explore-"Linked List"
1.Remove Linked List Elementclass Solution {/** Iterative solution * */public: ListNode* removeElements(ListNode* head, int val) { if(head==NULL) return NULL; while(head->...原创 2018-11-13 10:50:37 · 169 阅读 · 0 评论 -
LeetCode-Explore-"Queue & Stack"
1.Walls and Gates要注意对超出范围的点的处理class Solution {public: void wallsAndGates(vector<vector<int>>& rooms) { if(rooms.size()==0) return; int row=rooms.s...原创 2018-11-12 10:57:25 · 151 阅读 · 0 评论 -
LeetCode-Explore-"Binary Tree"
1.Preorder,Inorder,Postorderclass Solution {//recursive solution//preorderprivate: void preOrder(TreeNode* cur,vector<int> &res){ if(cur==NULL) return; res...原创 2018-11-12 11:32:19 · 369 阅读 · 0 评论