题库chevron_right分类chevron_right有序集合
label

有序集合

59 道题目
简单: 3中等: 21困难: 35

有序集合 是技术面试里最常出现的能力维度之一。建议先掌握基础题型的边界处理,再逐步过渡到模式识别和复杂度 trade-off。

面试场景

高频考察问题建模、边界条件与口头表达的清晰度。

常见误区

只背模板不解释为什么,容易在追问里失分。

练习策略

每轮练 3-5 题,固定复盘复杂度和可替代解法。

推荐练习顺序

#题目难度
218

天际线问题

The Skyline Problem requires calculating a city's silhouette using array manipulation and divide-and-conquer techniques …

困难
220

存在重复元素 III

The problem involves finding a pair of indices in an array where the index and value differences are within given limits…

困难
315

计算右侧小于当前元素的个数

Solve the Count of Smaller Numbers After Self problem using binary search and optimized algorithms.

困难
327

区间和的个数

Count the number of subarray sums within a given inclusive range using optimized divide-and-conquer techniques efficient…

困难
352

将数据流变为多个不相交区间

The problem involves designing a class to summarize a data stream of non-negative integers as disjoint intervals using b…

困难
363

矩形区域不超过 K 的最大数值和

Solve the "Max Sum of Rectangle No Larger Than K" problem using binary search over the valid sum space to optimize space…

困难
456

132 模式

Identify whether a given integer array contains a 132 pattern subsequence using efficient stack and search techniques.

中等
493

翻转对

Count the number of reverse pairs in a given integer array using efficient algorithms like binary search and merge sort.

困难
497

非重叠矩形中的随机点

Design an algorithm to pick random points within non-overlapping rectangles using binary search and reservoir sampling.

中等
699

掉落的方块

Solve Falling Squares by efficiently computing maximum stack heights using arrays with segment tree optimization techniq…

困难
715

Range 模块

Design a RangeModule to track and query half-open intervals using segment trees or ordered sets.

困难
729

我的日程安排表 I

Implement a calendar supporting non-overlapping event bookings using binary search for efficient insertion and conflict …

中等
731

我的日程安排表 II

Implement a calendar that allows double bookings but prevents triple bookings, managing overlapping intervals efficientl…

中等
732

我的日程安排表 III

Implement My Calendar III to track maximum overlapping events efficiently using binary search and segment tree technique…

困难
850

矩形面积 II

The problem involves calculating the total area covered by multiple rectangles, ensuring overlap is counted only once.

困难
855

考场就座

Simulate an exam room where each student chooses a seat maximizing distance to others, using design plus heap structures…

中等
895

最大频率栈

Design a stack-like data structure to manage elements and handle frequent stack operations, including popping the most f…

困难
975

奇偶跳

Determine the number of valid starting indices in an array where you can reach the end with alternating odd and even jum…

困难
1348

推文计数

Design an efficient solution to track and retrieve tweet counts over different frequencies using binary search and hash …

中等
1418

点菜展示表

Generate a restaurant display table from orders by counting each food item per table using array scanning and hash looku…

中等
1438

绝对差不超过限制的最长连续子数组

Find the longest subarray with elements whose absolute difference is within a specified limit using a sliding window app…

中等
1606

找到处理最多请求的服务器

Given k servers and a series of requests, find the busiest server(s) using greedy strategies and efficient server tracki…

困难
1649

通过指令创建有序数组

The problem asks to compute the cost of inserting elements into a sorted array using a series of instructions.

困难
1675

数组的最小偏移量

Given a positive integer array, repeatedly double or halve elements to minimize the difference between its largest and s…

困难
1818

绝对差值和

Minimize the absolute sum difference between two integer arrays by replacing at most one element from the first array.

中等
1825

求出 MK 平均值

Find the MKAverage of a stream of integers using a queue-driven approach with efficient state management.

困难
1847

最近的房间

Find the closest hotel room meeting minimum size requirements using binary search over the valid answer space efficientl…

困难
1912

设计电影租借系统

Implement a movie rental system with efficient search, rent, drop, and report operations using arrays and hash lookups.

困难
2034

股票价格波动

Design an efficient algorithm for managing stock price fluctuations with incorrect and unordered data in a data stream.

中等
2035

将数组分成两个数组并最小化数组和的差

Partition an integer array into two equal halves to minimize the absolute difference of their sums using dynamic program…

困难
2102

序列顺序查询

Track rankings of locations with names and scores, adding new locations and retrieving top-ranked ones efficiently.

困难
2179

统计数组中好三元组数目

Count Good Triplets in an Array requires tracking index orders across two permutations efficiently using binary search.

困难
2213

由单个字符重复的最长子字符串

Solve Longest Substring of One Repeating Character by maintaining mergeable run information under character updates afte…

困难
2251

花期内花的数目

Find the number of flowers in full bloom at the given times for a list of people.

困难
2276

统计区间中的整数数目

Design and implement a data structure to efficiently add intervals and count the total number of integers covered by the…

困难
2336

无限集中的最小数字

Design a data structure to handle the smallest missing element in an infinite set, with the ability to add and remove el…

中等
2349

设计数字容器系统

Learn to implement a Number Container System using hash tables and design techniques to efficiently track numbers and in…

中等
2353

设计食物评分系统

Design a food rating system that tracks and updates ratings of foods, finding the highest rated items by cuisine.

中等
2363

合并相似的物品

Merge Similar Items combines values and weights from two lists, returning the result sorted by value.

简单
2382

删除操作后的最大子段和

Calculate the maximum segment sum after sequential removals using array plus union find for efficient merging of segment…

困难
2424

最长上传前缀

Calculate the longest continuous uploaded prefix in a video stream efficiently using a mix of binary search and data str…

中等
2426

满足不等式的数对数目

Count pairs in two arrays satisfying a given inequality condition using binary search over the valid answer space.

困难
2612

最少翻转操作数

Find the minimum number of operations to move a 1 in an array from a given start position to other positions, considerin…

困难
2659

将数组清空

Solve the "Make Array Empty" problem using binary search to determine the minimum number of operations required.

困难
2713

矩阵中严格递增的单元格数

Find the maximum number of cells that can be visited in a matrix by following strictly increasing values from a starting…

困难
2762

不间断子数组

Count all continuous subarrays efficiently using sliding window with running max-min state tracking for array consistenc…

中等
2763

所有子数组中不平衡数字之和

Learn how to compute the total imbalance across all subarrays by updating gap counts as each subarray expands.

困难
2817

限制条件下元素之间的最小绝对差

Find the minimum absolute difference between two array elements that are at least x indices apart using binary search.

中等
3092

最高频率的 ID

Track the most frequent ID after each update in a dynamic collection of IDs with changing frequencies.

中等
3102

最小化曼哈顿距离

Compute the minimum maximum Manhattan distance by removing one point using array math and geometry insights efficiently.

困难
3244

新增道路查询后的最短距离 II

The problem involves calculating the shortest path from city 0 to city n-1 after each road addition, leveraging greedy c…

困难
3408

设计任务管理器

Design a Task Manager that can efficiently handle task management operations such as adding, editing, executing, and rem…

中等
3477

水果成篮 II

Determine the number of fruit types that remain unplaced after all allocations in the "Fruits Into Baskets II" problem.

简单
3479

水果成篮 III

Fruits Into Baskets III requires placing fruits into baskets efficiently using binary search over the answer space for c…

中等
3507

移除最小数对使数组有序 I

This problem asks for the minimum number of operations to make an array non-decreasing by removing pairs of elements.

简单
3508

设计路由器

Efficiently design a Router class to manage network packets with memory limits using array scanning and hash lookups.

中等
3510

移除最小数对使数组有序 II

The problem asks to find the minimum number of operations to make an array non-decreasing by removing pairs of elements.

困难
3590

第 K 小的路径异或和

This problem involves finding the kth smallest distinct XOR sum for nodes in a subtree of a tree structure using binary-…

困难
3607

电网维护

Determine which power stations remain connected after maintenance using array scanning and hash lookups to track compone…

中等

关联高频模式

LeetCode 有序集合题型题解:59题训练路线