面试场景
高频考察问题建模、边界条件与口头表达的清晰度。
常见误区
只背模板不解释为什么,容易在追问里失分。
练习策略
每轮练 3-5 题,固定复盘复杂度和可替代解法。
推荐练习顺序
题库
线段树 题库
先展示一段最适合快速浏览的题目列表,继续滚动时再慢慢续载,避免专题页被长列表一下子拉穿。
慢加载专题题库
适合这类题很多的专题,先扫结构,再逐步深入。
当前展示 24 / 57 道题目
每次续载 24 题天际线问题
The Skyline Problem requires calculating a city's silhouette using array manipulation and divide-and-conquer techniques …
区域和检索 - 数组可修改
Implement a mutable range sum query using efficient design patterns to handle multiple updates and range sum queries.
计算右侧小于当前元素的个数
Solve the Count of Smaller Numbers After Self problem using binary search and optimized algorithms.
区间和的个数
Count the number of subarray sums within a given inclusive range using optimized divide-and-conquer techniques efficient…
根据身高重建队列
Reconstruct a queue based on the given heights and the number of taller people in front, using sorting and binary indexe…
翻转对
Count the number of reverse pairs in a given integer array using efficient algorithms like binary search and merge sort.
最长递增子序列的个数
This problem challenges you to find the number of longest increasing subsequences in a given array of integers.
掉落的方块
Solve Falling Squares by efficiently computing maximum stack heights using arrays with segment tree optimization techniq…
Range 模块
Design a RangeModule to track and query half-open intervals using segment trees or ordered sets.
我的日程安排表 I
Implement a calendar supporting non-overlapping event bookings using binary search for efficient insertion and conflict …
我的日程安排表 II
Implement a calendar that allows double bookings but prevents triple bookings, managing overlapping intervals efficientl…
我的日程安排表 III
Implement My Calendar III to track maximum overlapping events efficiently using binary search and segment tree technique…
矩形面积 II
The problem involves calculating the total area covered by multiple rectangles, ensuring overlap is counted only once.
子数组中占绝大多数的元素
Efficiently find the majority element in any subarray using a data structure optimized for multiple range queries.
统计作战单位数
Count the number of valid three-soldier teams using ratings with a state transition dynamic programming approach efficie…
最多 K 次交换相邻数位后得到的最小整数
Reorder digits using at most k adjacent swaps to produce the smallest possible integer, leveraging greedy selection effi…
找到最接近目标值的函数值
In this problem, you'll use binary search to find the closest value of a mysterious function to a given target.
奇妙序列
Implement a Fancy sequence supporting append, addAll, and multAll operations efficiently using cumulative math design te…
通过指令创建有序数组
The problem asks to compute the cost of inserting elements into a sorted array using a series of instructions.
从仓库到码头运输箱子
Optimize the minimum number of trips to deliver boxes to ports under strict ship constraints using dynamic programming t…
区间内查询数字的频率
Design a data structure to handle efficient frequency queries for subarrays, focusing on hash-based lookups and efficien…
统计数组中好三元组数目
Count Good Triplets in an Array requires tracking index orders across two permutations efficiently using binary search.
由单个字符重复的最长子字符串
Solve Longest Substring of One Repeating Character by maintaining mergeable run information under character updates afte…
统计区间中的整数数目
Design and implement a data structure to efficiently add intervals and count the total number of integers covered by the…
swap_vert在题库框内继续向下滚动,也会自动续载