- 博客(6)
- 资源 (2)
- 收藏
- 关注
原创 Spiral Matrix II
class Solution { public: vector> generateMatrix(int n) { vector> result(n,vector(n,0)); int circle = ceil(float(n)/2); int num = 1; for(int i = 1;i <= circle;+
2015-07-29 13:46:34 243
原创 Single Number II
class Solution { public: int singleNumber(vector& nums) { int len = nums.size(); if(len == 1) return nums[0]; sort(nums.begin(),nums.end());
2015-07-28 23:09:45 264
转载 Rotate List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* ro
2015-07-21 17:09:58 248
转载 Longest Valid Parentheses
class Solution { public: int longestValidParentheses(string s) { const int size = s.size(); int start = -1; int res = 0; stack stackdata; for(int i=0 ;
2015-07-08 14:09:21 263
转载 Binary Tree Right Side View
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ clas
2015-07-06 19:08:17 277
转载 Binary Tree Maximum Path Sum
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ clas
2015-07-06 18:55:26 338
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人