
队列
文章平均质量分 78
队列问题
撒浪嘿呦x
我爱学习!
展开
-
数据结构 单调队列
滑动窗口给定一个大小为 n≤10^6 的数组。有一个大小为 k 的滑动窗口,它从数组的最左边移动到最右边。你只能在窗口中看到 k 个数字。每次滑动窗口向右移动一个位置。以下是一个例子:该数组为 [1 3 -1 -3 5 3 6 7],k 为 3。你的任务是确定滑动窗口位于每个位置时,窗口中的最大值和最小值。输入格式输入包含两行。第一行包含两个整数 n 和 k,分别代表数组长度和滑动窗口的长度。第二行有 n 个整数,代表数组的具体数值。同行数据之间用空格隔开。输出格式输出包含两个原创 2022-02-06 23:01:51 · 268 阅读 · 0 评论 -
每日一题 Fence Repair
Fence RepairDescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length Li (1 ≤ Li ≤ 50,000) units. He then purcha原创 2021-03-08 22:46:13 · 346 阅读 · 0 评论 -
每日一题 Expedition
ExpeditionDescriptionA group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately managed to run over a rock and puncture the truck’s fuel tank. The truck now leaks one unit of fuel原创 2021-03-15 22:54:46 · 246 阅读 · 0 评论