摘要: 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-18 20:02 Ci_pea 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 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 transaction 阅读全文
posted @ 2017-03-18 19:43 Ci_pea 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. 自己写的~~ for i in range(1,2): i 只能取到1 阅读全文
posted @ 2017-03-18 19:05 Ci_pea 阅读(194) 评论(0) 推荐(0) 编辑
摘要: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return explanation: Any row can be constructed using th 阅读全文
posted @ 2017-03-18 17:09 Ci_pea 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F 阅读全文
posted @ 2017-03-18 16:59 Ci_pea 阅读(120) 评论(0) 推荐(0) 编辑