摘要:
Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.分析不能用除法,所以使用减法不断减 除数,同时对 除数 倍乘,进行加速除数:3 -> 6 -> 12 ...边界条件:1 除数为0,溢出2 被除数 INT_MIN,同时除数 -1,... 阅读全文
摘要:
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 ha... 阅读全文
摘要:
Given an array of integers sorted in ascending order, 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 i... 阅读全文
摘要:
Suppose an array sorted in ascending order 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 a... 阅读全文