摘要: #week19 There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 yo 阅读全文
posted @ 2018-01-13 04:41 小预备 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #week18 Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: 分析: 这是一题比较简单的递归 阅读全文
posted @ 2018-01-13 04:37 小预备 阅读(169) 评论(0) 推荐(0) 编辑
摘要: #week17 There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 yo 阅读全文
posted @ 2018-01-13 04:31 小预备 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #week16 Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i 阅读全文
posted @ 2018-01-13 04:21 小预备 阅读(123) 评论(0) 推荐(0) 编辑
摘要: #week15 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 ma 阅读全文
posted @ 2018-01-13 04:13 小预备 阅读(188) 评论(0) 推荐(0) 编辑
摘要: #week14 Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i 阅读全文
posted @ 2018-01-13 04:05 小预备 阅读(299) 评论(0) 推荐(0) 编辑
摘要: #week13 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 it 阅读全文
posted @ 2018-01-13 03:59 小预备 阅读(154) 评论(0) 推荐(0) 编辑
摘要: #week12 Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The lon 阅读全文
posted @ 2018-01-13 03:52 小预备 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #week11 Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 2 Explanation: T 阅读全文
posted @ 2018-01-13 03:41 小预备 阅读(172) 评论(0) 推荐(0) 编辑
摘要: #week10 On an NxN chessboard, a knight starts at the r-th row and c-th column and attempts to make exactly K moves. The rows and columns are 0 indexed 阅读全文
posted @ 2018-01-13 03:23 小预备 阅读(175) 评论(0) 推荐(0) 编辑
摘要: #week9 Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3, 阅读全文
posted @ 2018-01-13 03:11 小预备 阅读(173) 评论(0) 推荐(0) 编辑
摘要: #week8 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one tran 阅读全文
posted @ 2018-01-13 02:59 小预备 阅读(157) 评论(0) 推荐(0) 编辑
摘要: #week7 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stop 阅读全文
posted @ 2018-01-13 02:40 小预备 阅读(206) 评论(0) 推荐(0) 编辑
摘要: #week6 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 分析: 动态规划类型 代码: 超时版本: 修改为一维 阅读全文
posted @ 2018-01-13 02:23 小预备 阅读(143) 评论(0) 推荐(0) 编辑
摘要: #week5 问题: On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or t 阅读全文
posted @ 2018-01-13 02:01 小预备 阅读(205) 评论(0) 推荐(0) 编辑