
leetcode
文章平均质量分 88
leo1949asd
这个作者很懒,什么都没留下…
展开
-
Search for a Range -- leetcode
Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found原创 2014-07-29 16:10:24 · 733 阅读 · 0 评论 -
Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get原创 2014-11-20 19:29:57 · 734 阅读 · 0 评论 -
Maximum Product Subarray 以及cout的输出顺序问题的讨论
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the larges原创 2014-11-20 19:28:02 · 886 阅读 · 0 评论 -
151 Reverse Words in a String
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". Update (2015-02-12): For C programmers: Try to solve it in-place in原创 2015-03-15 18:32:22 · 508 阅读 · 0 评论 -
Maximum Subarray
class Solution { public: int maxSubArray(int A[], int n) { int res = INT_MIN; int tem = 0; for(int i = 0; i < n; ++i) { tem = max(A[i],tem + A[i]);原创 2014-11-25 11:07:09 · 609 阅读 · 0 评论