isInterleave

#include #include #include #include using namespace std; bool isInterleave(string& s1,string& s2,string& s3) { vector>f(s1.size...

2015-11-23 00:12:53

阅读数:172

评论数:0

maxProfit

#include #include #include using namespace std; int maxProfit(vector&prices) { const int n=prices.size(); if(n return 0; vectorf(n,0); ...

2015-11-22 21:59:04

阅读数:291

评论数:0

maximalRectangle

#include #include #include using namespace std; int maximalRectangle(vector>&matrix) { const int m=matrix.size(); const int n=matrix[0]...

2015-11-22 17:00:35

阅读数:170

评论数:0

minCut

#include #include #include #include using namespace std; int minCut(string s) { const int n = s.size(); vectorf(n+1); bool p[100][100]; fil...

2015-11-21 15:35:34

阅读数:158

评论数:0

maxSubArray

#include #include using namespace std; int maxSubArray(int A[],int n) { int result=INT_MIN,f=0; for(int i=0;i { f=max(f+A[i],A[i]); result=m...

2015-11-20 23:02:07

阅读数:148

评论数:0

triangle

#include #include #include using namespace std; int minimumTotal(vector>&triangle) { for(int i=triangle.size()-2;i>=0;--i) { for(in...

2015-11-20 22:23:02

阅读数:150

评论数:0

container with most water

#include #include #include using namespace std; int maxArea(vector&height) { int left = 0; int right = height.size() - 1; int result = 0;...

2015-11-11 16:11:46

阅读数:136

评论数:0

longestSubstring

#include #include #include #include using namespace std; int lengthOfLongestSubsring(string s) { const int ascII = 26; int last[ascII] = { -1...

2015-11-10 22:39:41

阅读数:149

评论数:0

canJump&&jumpII

#include #include #include using namespace std; bool canJump(int a[], int n) { int reach = 1; for (int i = 0;i { reach = max(reach, i + 1 + a[i]); }...

2015-11-10 16:20:23

阅读数:140

评论数:0

二分法pow和sqrt

#include using namespace std; int sqrt(int x) { if(x return 1; int left=1; int right=x/2; //int last_mid; while(left { int mid=left+(right...

2015-11-06 22:37:09

阅读数:240

评论数:0

wordSearch

#include #include #include using namespace std; bool dfs(vector>&board,string&word,int index,int x,int y,vector>&visited) { i...

2015-11-06 17:05:45

阅读数:133

评论数:0

generateParenthesses

#include #include #include using namespace std; void generate(int n,string s,int l,int r,vector&result) { if(l==n) { s.append(n-r,')'); result.pu...

2015-11-05 20:12:29

阅读数:138

评论数:0

combinationSum&&combinationSumII

#include #include #include #include using namespace std; void dfs(vector&nums,int gap,int start,vector&intermediate,vector>&result) { ...

2015-11-05 13:29:24

阅读数:141

评论数:0

storeIpAddresses

#include #include #include using namespace std; void dfs(string s,size_t start,size_t step,string&ip,vector& result) { if(start==s.size...

2015-11-05 12:47:24

阅读数:149

评论数:0

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