
LeetCode题库总结
@眼里有星河
做一个帅气的工程师
展开
-
Leetcode (Container With Most Water&&String to Integer (atoi))
class Solution { public: int maxArea(vector<int>& height) { int water=0; int i=0; int j=height.size()-1; while(i<j) { int h=min(height[i],height[j]); water=max(water,(j-i)*h);原创 2020-10-14 20:49:05 · 158 阅读 · 0 评论 -
Leetcode Longest Palindromic Substring
从零开始遍历 class Solution { public: string longestPalindrome(string s) { int length=s.size(); int maxlength=1; int l,r; int start=0; ///< recycle start reom zerom,which used twenty ms for(int i=0;i<leng原创 2020-10-13 21:38:40 · 137 阅读 · 0 评论 -
Leetcode 3. Longest Substring Without Repeating Characters
class Solution { public: int lengthOfLongestSubstring(string s) { /*unordered_set<char>occu; int j=-1; int ans=0; int length=s.size(); for(int i=0;i<length;++i) { if(i>0)原创 2020-10-08 22:26:12 · 141 阅读 · 0 评论