摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array return its index, otherwise return -1.You may assume no duplicate exists in the array.思考:二分搜索。class Solution {publi 阅读全文
posted @ 2013-11-28 23:44 七年之后 阅读(156) 评论(0) 推荐(0) 编辑
摘要: Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which has length = 2.Another example is ")()())", where the lo 阅读全文
posted @ 2013-11-28 13:41 七年之后 阅读(199) 评论(0) 推荐(0) 编辑