摘要:
题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Ele... 阅读全文
摘要:
题目:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum ... 阅读全文
摘要:
Best Time to Buy and Sell Stock I题目:Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to ... 阅读全文
摘要:
题目:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints ... 阅读全文
摘要:
题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).Find the minimum element.Yo... 阅读全文
摘要:
题目:A peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return its ind... 阅读全文
摘要:
题目:According to theWikipedia's article: "TheGame of Life, also known simply asLife, is a cellular automaton devised by the British mathematician John ... 阅读全文
摘要:
题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your max... 阅读全文
摘要:
题目:Given an integer array of sizen, find all elements that appear more than⌊ n/3 ⌋times. The algorithm should run in linear time and in O(1) space.思路:... 阅读全文
摘要:
题目: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],... 阅读全文
摘要:
题目:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2... 阅读全文
摘要:
题目:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note... 阅读全文