ICode9

精准搜索请尝试: 精确搜索
  • [Leetcode188] 买卖股票的最佳时机IV 动态规划 解题报告2019-04-05 18:49:27

    题源:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iv/   本题代码: 1 /** 2 * @author yuan 3 * @version 0.1 4 * @date 2019/4/5 5 */ 6 public class Leetcode188 { 7 8 private int getBetterBuy(int[] buy, int[] sell, int price, int i) {

  • LeetCode-714.Best Time to Buy and Sell Stock with Transaction Fee2019-04-05 17:51:53

    Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer feerepresenting a transaction fee. You may complete as many transactions as you like, but you need to pay the transac

  • LeetCode-123.Best Time to Buy and Sell Stock III2019-04-02 21:48:59

    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 complete at most twotransactions. Note: You may not engage in multiple transactions at the same time (i.e., you

  • Leetcode122-Best Time to Buy and Sell Stock II-Easy2019-03-30 16:38:58

    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 complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times). Note:

  • leetcode 122. 买卖股票的最佳时机 II(Best Time to Buy and Sell Stock II)2019-03-19 17:42:10

    目录 题目描述: 示例 1: 示例 2: 示例 3: 解法: 题目描述: 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 设计一个算法来计算你所能获取的最大利润。你可以尽可能地完成更多的交易(多次买卖一支股票)。 注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股

  • 122. Best Time to Buy and Sell Stock II2019-03-10 12:48:10

    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 complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times). Note:

  • 188. 买卖股票的最佳时机 IV hard2019-03-07 21:48:55

    给定一个数组,它的第 i 个元素是一支给定的股票在第 i 天的价格。 设计一个算法来计算你所能获取的最大利润。你最多可以完成 k 笔交易。 注意: 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 示例 1: 输入: [2,4,1], k = 2 输出: 2 解释: 在第 1 天 (股

  • Leetcode - 309. Best Time to Buy and Sell Stock with Cooldown2019-02-28 22:48:35

    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 complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times) with the

  • Buy Low Sell High CodeForces - 867E (思维,贪心)2019-02-01 09:47:27

    大意: 第i天可以花$a_i$元买入或卖出一股或者什么也不干, 初始没钱, 求i天后最大收益   考虑贪心, 对于第$x$股, 如果$x$之前有比它便宜的, 就在之前的那一天买, 直接将$x$卖掉. 并不需要计算出最优的卖出时间, 因为若$x$后有更优价格, 可以再买回$x$, 不影响贪心结果   #inclu

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有