摘要:
Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−... 阅读全文
摘要:
Climbing StairsYou are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct way... 阅读全文
摘要:
Single Number IIIGiven an array of numbersnums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find t... 阅读全文
摘要:
Single Number IIGiven an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a lin... 阅读全文
摘要:
Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if ... 阅读全文
摘要:
Unique Binary Search TreesGivenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a to... 阅读全文
摘要:
Majority ElementGiven an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may ass... 阅读全文
摘要:
N-Queens IIFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.和上题N-Queens几乎一样,... 阅读全文