leetcode.com 2025-12-06
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
🟡3578.count-partitions-with-max-min-difference-at-most-k
🏷️ Tags
#queue #array #dynamic_programming #prefix_sum #sliding_window #monotonic_queue
Telegraph
count-partitions-with-max-min-difference-at-most-k
You are given an integer array nums and an integer k. Your task is to partition nums into one or more non-empty contiguous segments such that in each segment, the difference between its maximum and minimum elements is at most k. Return the total number of…
leetcode.cn 2025-12-10
🟡3577.count-the-number-of-computer-unlocking-permutations
🏷️ Tags
#brainteaser #array #math #combinatorics
🟡3577.count-the-number-of-computer-unlocking-permutations
🏷️ Tags
#brainteaser #array #math #combinatorics
Telegraph
count-the-number-of-computer-unlocking-permutations
给你一个长度为 n 的数组 complexity。 在房间里有 n 台 上锁的 计算机,这些计算机的编号为 0 到 n - 1,每台计算机都有一个 唯一 的密码。编号为 i 的计算机的密码复杂度为 complexity[i]。 编号为 0 的计算机密码已经 解锁 ,并作为根节点。其他所有计算机必须通过它或其他已经解锁的计算机来解锁,具体规则如下:
leetcode.com 2025-12-10
🟡3577.count-the-number-of-computer-unlocking-permutations
🏷️ Tags
#brainteaser #array #math #combinatorics
🟡3577.count-the-number-of-computer-unlocking-permutations
🏷️ Tags
#brainteaser #array #math #combinatorics
Telegraph
count-the-number-of-computer-unlocking-permutations
You are given an array complexity of length n. There are n locked computers in a room with labels from 0 to n - 1, each with its own unique password. The password of the computer i has a complexity complexity[i]. The password for the computer labeled 0 is…
leetcode.cn 2025-12-14
🔴2147.number-of-ways-to-divide-a-long-corridor
🏷️ Tags
#math #string #dynamic_programming
🔴2147.number-of-ways-to-divide-a-long-corridor
🏷️ Tags
#math #string #dynamic_programming
Telegraph
number-of-ways-to-divide-a-long-corridor
在一个图书馆的长廊里,有一些座位和装饰植物排成一列。给你一个下标从 0 开始,长度为 n 的字符串 corridor ,它包含字母 'S' 和 'P' ,其中每个 'S' 表示一个座位,每个 'P' 表示一株植物。 在下标 0 的左边和下标 n - 1 的右边 已经 分别各放了一个屏风。你还需要额外放置一些屏风。每一个位置 i - 1 和 i 之间(1 <= i <= n - 1),至多能放一个屏风。 请你将走廊用屏风划分为若干段,且每一段内都 恰好有两个座位 ,而每一段内植物的数目没有要求。可能有多种…
leetcode.com 2025-12-14
🔴2147.number-of-ways-to-divide-a-long-corridor
🏷️ Tags
#math #string #dynamic_programming
🔴2147.number-of-ways-to-divide-a-long-corridor
🏷️ Tags
#math #string #dynamic_programming
Telegraph
number-of-ways-to-divide-a-long-corridor
Along a long library corridor, there is a line of seats and decorative plants. You are given a 0-indexed string corridor of length n consisting of letters 'S' and 'P' where each 'S' represents a seat and each 'P' represents a plant. One room divider has already…
leetcode.cn 2025-12-15
🟡2110.number-of-smooth-descent-periods-of-a-stock
🏷️ Tags
#array #math #dynamic_programming
🟡2110.number-of-smooth-descent-periods-of-a-stock
🏷️ Tags
#array #math #dynamic_programming
Telegraph
number-of-smooth-descent-periods-of-a-stock
给你一个整数数组 prices ,表示一支股票的历史每日股价,其中 prices[i] 是这支股票第 i 天的价格。 一个 平滑下降的阶段 定义为:对于 连续一天或者多天 ,每日股价都比 前一日股价恰好少 1 ,这个阶段第一天的股价没有限制。 请你返回 平滑下降阶段 的数目。 示例 1: 输入:prices = [3,2,1,4] 输出:7 解释:总共有 7 个平滑下降阶段: [3], [2], [1], [4], [3,2], [2,1] 和 [3,2,1] 注意,仅一天按照定义也是平滑下降阶段。…
leetcode.com 2025-12-15
🟡2110.number-of-smooth-descent-periods-of-a-stock
🏷️ Tags
#array #math #dynamic_programming
🟡2110.number-of-smooth-descent-periods-of-a-stock
🏷️ Tags
#array #math #dynamic_programming
Telegraph
number-of-smooth-descent-periods-of-a-stock
You are given an integer array prices representing the daily price history of a stock, where prices[i] is the stock price on the ith day. A smooth descent period of a stock consists of one or more contiguous days such that the price on each day is lower than…
leetcode.cn 2025-12-16
🔴3562.maximum-profit-from-trading-stocks-with-discounts
🏷️ Tags
#tree #depth_first_search #array #dynamic_programming
🔴3562.maximum-profit-from-trading-stocks-with-discounts
🏷️ Tags
#tree #depth_first_search #array #dynamic_programming
Telegraph
maximum-profit-from-trading-stocks-with-discounts
给你一个整数 n,表示公司中员工的数量。每位员工都分配了一个从 1 到 n 的唯一 ID ,其中员工 1 是 CEO。另给你两个下标从 1 开始的整数数组 present 和 future,两个数组的长度均为 n,具体定义如下: