leetoj
文章平均质量分 62
鸫岽
这个作者很懒,什么都没留下…
展开
-
Container With Most Water
class Solution { public: int maxArea(vector& height) { int l = height.size(); int i = 0, j = l-1; int mx = 0; while(i { mx = max(mx, mi原创 2018-01-21 17:05:23 · 134 阅读 · 0 评论 -
4Sum
18. 4Sum DescriptionHintsSubmissionsDiscussSolution DiscussPick One Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = targ原创 2018-01-22 11:01:55 · 186 阅读 · 0 评论 -
22. Generate Parentheses
22. Generate Parentheses DescriptionHintsSubmissionsDiscussSolution DiscussPick One Given n pairs of parentheses, write a function to generate all combinations of well-f原创 2018-01-23 10:01:31 · 158 阅读 · 0 评论 -
在两个有序数组中找第k大
double findkth(int a[], int n, int b[], int m, int k) { if(m > n) return findkth(b, m, a, n, k); if(m == 0) return a[k - 1]; if(k == 1) return a[0] < b[0] ? a[0]: b[原创 2018-01-07 16:07:17 · 583 阅读 · 1 评论 -
最长回文串
class Solution { public: string longestPalindrome(string s) { int ans1 = 0, ans2 = 0; for(int i = 0; i < s.size(); ) { int l = i, r = i; while(r原创 2018-01-07 16:57:21 · 132 阅读 · 0 评论 -
Longest Valid Parentheses(最长合法括号对长度)
32. Longest Valid Parentheses DescriptionHintsSubmissionsDiscussSolution DiscussPick One Given a string containing just the characters '(' and ')', find the length o原创 2018-01-24 11:38:19 · 183 阅读 · 0 评论 -
时间O(n)不用多申请空间找到缺失的第一个正整数
41. First Missing Positive DescriptionHintsSubmissionsDiscussSolution DiscussPick One Given an unsorted integer array, find the first missing positive integer. For exam原创 2018-01-26 15:16:10 · 233 阅读 · 0 评论