自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 收藏
  • 关注

原创 maven setting.xml

/path/to/local/reposetting.xml中删除的

2017-12-07 16:28:25 98

原创 maven

| Specifies the authentication information to use when connecting to a particular server, identified by     | a unique name within the system (referred to by the 'id' attribute below).     |    

2017-12-06 21:32:02 120

原创 tomcat

" roles="tomcat"/>  " roles="tomcat,role1"/>  " roles="role1"/>删掉的server-user.xml中的东西

2017-12-06 21:30:13 256

原创 习题8.14

1.证明这个问题是NP问题。给定包含无向图G中的一个规模为k的团以及一个规模为k的独立集的解S。通过在图G中遍历S中的团和独立集中的每一个节点,就可以判定他们是不是团和独立集,时间复杂度是O(k2),为多项式时间。证明该问题是一个NP问题。2.证明这个问题是NP-hard问题。相当于证明独立集问题能够在多项式时间内归约到本问题。独立集问题指的是,对于给定的图G,要求判定图G中是否存在一

2017-07-05 22:21:19 261

原创 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) {} * };

2017-06-21 10:54:58 109

原创 Minimum Depth of Binary Tree

/** * Definition for a binary tree node. * struct TreeNode { *     int val; *     TreeNode *left; *     TreeNode *right; *     TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };

2017-06-21 10:27:59 121

原创 Min Stack

class MinStack {public:    /** initialize your data structure here. */    stack s;    stack min;   // MinStack() {   //     return min.top();   // }        void push(int x) {      

2017-05-08 18:08:56 131

原创 Linked List Cycle

/** * Definition for singly-linked list. * struct ListNode { *     int val; *     ListNode *next; *     ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:    bo

2017-05-08 17:40:20 123

原创 Maximum Depth of Binary Tree

/** * Definition for a binary tree node. * struct TreeNode { *     int val; *     TreeNode *left; *     TreeNode *right; *     TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };

2017-05-07 14:33:47 166

原创 Symmetric Tree

/** * Definition for a binary tree node. * struct TreeNode { *     int val; *     TreeNode *left; *     TreeNode *right; *     TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };

2017-05-05 23:57:45 116

原创 Remove Duplicates from Sorted List

/** * Definition for singly-linked list. * struct ListNode { *     int val; *     ListNode *next; *     ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:    Li

2017-05-05 17:46:12 219

原创 Merge Sorted Array

class Solution {public:    void merge(vector& nums1, int m, vector& nums2, int n) {         m=m-1;         n=n-1;        int i=m+n+1;        while(m>=0||n>=0)        {            if(m

2017-05-05 17:32:34 141

原创 Same Tree

/** * Definition for a binary tree node. * struct TreeNode { *     int val; *     TreeNode *left; *     TreeNode *right; *     TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };

2017-05-05 16:58:02 135

原创 Climbing Stairs

class Solution {public:    int climbStairs(int n) {        if(n        return 1;        vector dp(n);        dp[0]=1;dp[1]=2;        for(int i=2;i        {            dp[i]=dp[i-1]+d

2017-05-03 16:49:42 158

原创 Sqrt(x)

class Solution {public:    int mySqrt(int x) {         int i = 0;       int j = x/2 + 1;       while(i        {            long mid = (i+j)/2; //这里用long long 是方便下面计算sq不用再转换,如果用int会报错 

2017-05-03 15:33:25 182

原创 Add Binary

class Solution {public:    string addBinary(string a, string b) {        int sizea=a.size();        int sizeb=b.size();        if(sizea        return addBinary(b,a);        string zeros(

2017-04-26 11:32:50 206

原创 Count and Say

class Solution {  public:      string revolution(string s)      {          string ret="";        int count=1;       char pre=s[0];       for(int i=0;i       {           if(s[i+1]==pr

2017-04-19 12:20:05 119

原创 Search Insert Position

class Solution {public:    int searchInsert(vector& nums, int target) {        if(nums.size()==0)        return 0;        int low=0;        int high=nums.size()-1;        while(low   

2017-04-18 23:45:00 133

原创 Remove Element

class Solution {public:    int removeElement(vector& nums, int val) {        int removecount=0;        for(int i=0;i        {            if(nums[i]==val)            removecount++;     

2017-04-18 17:38:19 112

原创 Remove Duplicates from Sorted Array

class Solution {    public: int removeDuplicates(vector& nums) {        if(nums.size() == 0) return 0;        int dup = nums[0];        int end = 1;        for(int i = 1; i             if(

2017-04-18 16:54:17 157

原创 Merge Two Sorted Lists

/** * Definition for singly-linked list. * struct ListNode { *     int val; *     ListNode *next; *     ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:    Li

2017-04-18 00:05:35 325

原创 Valid Parentheses

class Solution {public:    bool isValid(string s) {                stack charstack;        size_t i=0;        while(i        {            char c=s[i];            if(c!=')'&&c!='}'&&c

2017-03-24 10:19:38 139

原创 leetcode----Palindrome Number

class Solution {public:    bool isPalindrome(int x) {        if(x         int div = 1;        while(x / div >= 10) div *= 10;        while(x){            int l = x / div; //计算第一位数字的值 

2017-03-14 09:52:18 104

原创 Longest Common Prefix

class Solution {public:    string longestCommonPrefix(vector& strs) {                if(strs.empty())//字符串为空,则返回空的最长公共子串                    return "";                else if(strs.s

2017-03-14 09:42:05 162

原创 two sum

代码:class Solution {public:    vector twoSum(vector& nums, int target) {         vector result;        int index1,index2;        for(index1=0;index1        for(index2=index1+1;index2

2017-02-24 20:22:59 168

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除