Fork me on GitHub
摘要: Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2 阅读全文
posted @ 2017-03-08 11:00 hellowOOOrld 阅读(172) 评论(0) 推荐(0) 编辑
摘要: Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example, If nums = 阅读全文
posted @ 2017-03-07 17:24 hellowOOOrld 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space 阅读全文
posted @ 2017-03-06 18:18 hellowOOOrld 阅读(157) 评论(0) 推荐(0) 编辑
摘要: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p 阅读全文
posted @ 2017-03-06 17:17 hellowOOOrld 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2017-03-04 17:47 hellowOOOrld 阅读(139) 评论(0) 推荐(0) 编辑
摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文
posted @ 2017-03-04 15:03 hellowOOOrld 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文
posted @ 2017-03-03 16:04 hellowOOOrld 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 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, 阅读全文
posted @ 2017-03-03 13:32 hellowOOOrld 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumR 阅读全文
posted @ 2017-03-03 10:01 hellowOOOrld 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2017-03-02 20:29 hellowOOOrld 阅读(164) 评论(0) 推荐(0) 编辑