摘要: Problem Difinition:Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the arr... 阅读全文
posted @ 2015-08-04 22:49 曾可爱 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Just...Implement pow(x, n).Solution:1)Naive solution:multiply x by itself for n-1 times. (Or simply reyurn 1 if n==0).This takes O(n) time. When n is ... 阅读全文
posted @ 2015-08-04 21:31 曾可爱 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.Solution:要求把所有存在an... 阅读全文
posted @ 2015-08-04 20:56 曾可爱 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-pl... 阅读全文
posted @ 2015-08-04 20:44 曾可爱 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the ... 阅读全文
posted @ 2015-08-04 19:38 曾可爱 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[1,2,3], [1,3,... 阅读全文
posted @ 2015-08-04 18:56 曾可爱 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily lar... 阅读全文
posted @ 2015-08-04 16:58 曾可爱 阅读(149) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers ... 阅读全文
posted @ 2015-08-04 16:20 曾可爱 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to... 阅读全文
posted @ 2015-08-04 16:12 曾可爱 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:Given 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 it ... 阅读全文
posted @ 2015-08-04 16:04 曾可爱 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Problem Definition:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity... 阅读全文
posted @ 2015-08-04 15:48 曾可爱 阅读(169) 评论(0) 推荐(0) 编辑