leetcode.cn 2023-10-05
🟡309.best-time-to-buy-and-sell-stock-with-cooldown
🏷️ Tags
#array #dynamic_programming
🟡309.best-time-to-buy-and-sell-stock-with-cooldown
🏷️ Tags
#array #dynamic_programming
Telegraph
best-time-to-buy-and-sell-stock-with-cooldown
给定一个整数数组prices,其中第 prices[i] 表示第 i 天的股票价格 。 设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票):
leetcode.cn 2023-10-06
🟡714.best-time-to-buy-and-sell-stock-with-transaction-fee
🏷️ Tags
#greedy #array #dynamic_programming
🟡714.best-time-to-buy-and-sell-stock-with-transaction-fee
🏷️ Tags
#greedy #array #dynamic_programming
Telegraph
best-time-to-buy-and-sell-stock-with-transaction-fee
给定一个整数数组 prices,其中 prices[i]表示第 i 天的股票价格 ;整数 fee 代表了交易股票的手续费用。 你可以无限次地完成交易,但是你每笔交易都需要付手续费。如果你已经购买了一个股票,在卖出它之前你就不能再继续购买股票了。 返回获得利润的最大值。 注意:这里的一笔交易指买入持有并卖出股票的整个过程,每笔交易你只需要为支付一次手续费。 示例 1: 输入:prices = [1, 3, 2, 8, 4, 9], fee = 2 输出:8 解释:能够达到的最大利润: 在此处买入 prices[0]…
leetcode.com 2023-10-07
🔴1420.build-array-where-you-can-find-the-maximum-exactly-k-comparisons
🏷️ Tags
#dynamic_programming #prefix_sum
🔴1420.build-array-where-you-can-find-the-maximum-exactly-k-comparisons
🏷️ Tags
#dynamic_programming #prefix_sum
Telegraph
build-array-where-you-can-find-the-maximum-exactly-k-comparisons
You are given three integers n, m and k. Consider the following algorithm to find the maximum element of an array of positive integers: You should build the array arr which has the following properties:
leetcode.cn 2023-10-08
🟡2034.stock-price-fluctuation
🏷️ Tags
#design #hash_table #data_stream #ordered_set #heap_priority_queue
🟡2034.stock-price-fluctuation
🏷️ Tags
#design #hash_table #data_stream #ordered_set #heap_priority_queue
Telegraph
stock-price-fluctuation
给你一支股票价格的数据流。数据流中每一条记录包含一个 时间戳 和该时间点股票对应的 价格 。 不巧的是,由于股票市场内在的波动性,股票价格记录可能不是按时间顺序到来的。某些情况下,有的记录可能是错的。如果两个有相同时间戳的记录出现在数据流中,前一条记录视为错误记录,后出现的记录 更正 前一条错误的记录。 请你设计一个算法,实现:
leetcode.com 2023-10-09
🟡34.find-first-and-last-position-of-element-in-sorted-array
🏷️ Tags
#array #binary_search
🟡34.find-first-and-last-position-of-element-in-sorted-array
🏷️ Tags
#array #binary_search
Telegraph
find-first-and-last-position-of-element-in-sorted-array
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. You must write an algorithm with O(log n) runtime complexity. Example 1:…
leetcode.com 2023-10-10
🔴2009.minimum-number-of-operations-to-make-array-continuous
🏷️ Tags
#array #binary_search
🔴2009.minimum-number-of-operations-to-make-array-continuous
🏷️ Tags
#array #binary_search
Telegraph
minimum-number-of-operations-to-make-array-continuous
You are given an integer array nums. In one operation, you can replace any element in nums with any integer. nums is considered continuous if both of the following conditions are fulfilled:
leetcode.cn 2023-10-11
🟡2512.reward-top-k-students
🏷️ Tags
#array #hash_table #string #sorting #heap_priority_queue
🟡2512.reward-top-k-students
🏷️ Tags
#array #hash_table #string #sorting #heap_priority_queue
Telegraph
reward-top-k-students
给你两个字符串数组 positive_feedback 和 negative_feedback ,分别包含表示正面的和负面的词汇。不会 有单词同时是正面的和负面的。 一开始,每位学生分数为 0 。每个正面的单词会给学生的分数 加 3 分,每个负面的词会给学生的分数 减 1 分。 给你 n 个学生的评语,用一个下标从 0 开始的字符串数组 report 和一个下标从 0 开始的整数数组 student_id 表示,其中 student_id[i] 表示这名学生的 ID ,这名学生的评语是 report[i] 。每名学生的…
leetcode.com 2023-10-11
🔴2251.number-of-flowers-in-full-bloom
🏷️ Tags
#array #hash_table #binary_search #ordered_set #prefix_sum #sorting
🔴2251.number-of-flowers-in-full-bloom
🏷️ Tags
#array #hash_table #binary_search #ordered_set #prefix_sum #sorting
Telegraph
number-of-flowers-in-full-bloom
You are given a 0-indexed 2D integer array flowers, where flowers[i] = [starti, endi] means the ith flower will be in full bloom from starti to endi (inclusive). You are also given a 0-indexed integer array people of size n, where people[i] is the time that…
leetcode.cn 2023-10-12
🟢2562.find-the-array-concatenation-value
🏷️ Tags
#array #two_pointers #simulation
🟢2562.find-the-array-concatenation-value
🏷️ Tags
#array #two_pointers #simulation
Telegraph
find-the-array-concatenation-value
给你一个下标从 0 开始的整数数组 nums 。 现定义两个数字的 串联 是由这两个数值串联起来形成的新数字。