摘要: 题目: 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 co 阅读全文
posted @ 2017-08-27 23:06 糯米团子syj 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题目: 给定商品价格、特价组合、要买的商品数量,给出买到指定数量商品的最小花费 题解: 针对每个special offer,计算使用这个special offer后的花费,如果比minPrice少, 则保存为minPrice; 递归方法实现,如果商品数量是k,special offer的数量是n, 阅读全文
posted @ 2017-08-27 22:16 糯米团子syj 阅读(1246) 评论(1) 推荐(0) 编辑
摘要: 题目: A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is 阅读全文
posted @ 2017-08-27 19:02 糯米团子syj 阅读(147) 评论(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 transac 阅读全文
posted @ 2017-08-27 18:10 糯米团子syj 阅读(150) 评论(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 stoppin 阅读全文
posted @ 2017-08-27 17:55 糯米团子syj 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 解题: 思路一: 因为看到题目的要求是sumRange要频繁的调用 阅读全文
posted @ 2017-08-27 17:35 糯米团子syj 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 题目: 求获取n个A的最小操作步骤的数目minStep Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Gi 阅读全文
posted @ 2017-08-27 17:04 糯米团子syj 阅读(1525) 评论(0) 推荐(0) 编辑