面试场景
高频考察问题建模、边界条件与口头表达的清晰度。
常见误区
只背模板不解释为什么,容易在追问里失分。
练习策略
每轮练 3-5 题,固定复盘复杂度和可替代解法。
推荐练习顺序
天际线问题
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.
子数组中占绝大多数的元素
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…
查询带键的排列
This problem involves processing queries on a permutation using an array and binary indexed tree for efficient results.
最多 K 次交换相邻数位后得到的最小整数
Reorder digits using at most k adjacent swaps to produce the smallest possible integer, leveraging greedy selection effi…
通过指令创建有序数组
The problem asks to compute the cost of inserting elements into a sorted array using a series of instructions.
找出到每个位置为止最长的有效障碍赛跑路线
Compute the longest valid obstacle course at each position using binary search and careful array tracking techniques eff…
统计数组中好三元组数目
Count Good Triplets in an Array requires tracking index orders across two permutations efficiently using binary search.
得到回文串的最少操作次数
The problem challenges you to find the minimum number of adjacent swaps to make a string a palindrome.
统计包含每个点的矩形数目
Given a set of rectangles and points, determine how many rectangles contain each point.
以组为单位订音乐会的门票
Design a ticketing system to allocate concert seats in specific groupings while efficiently handling seat reservations.
最长递增子序列 II
Determine the longest increasing subsequence in an array where consecutive elements differ by at most k using dynamic pr…
最长上传前缀
Calculate the longest continuous uploaded prefix in a video stream efficiently using a mix of binary search and data str…
满足不等式的数对数目
Count pairs in two arrays satisfying a given inequality condition using binary search over the valid answer space.
统计上升四元组
Given a permutation of numbers, count the number of increasing quadruplets using dynamic programming.
将数组清空
Solve the "Make Array Empty" problem using binary search to determine the minimum number of operations required.
最大和查询
Find the maximum sum of paired elements from two arrays under query constraints using efficient binary search techniques…
子数组不同元素数目的平方和 II
Compute the sum of squares of distinct elements in all subarrays using state transition dynamic programming efficiently.
平衡子序列的最大和
Learn to find the maximum sum of a balanced subsequence using dynamic programming and careful state transitions efficien…
找到 Alice 和 Bob 可以相遇的建筑
Determine the leftmost building where Alice and Bob can meet using a binary search over valid move sequences.
将元素分配到两个数组中 II
Distribute elements into two arrays based on conditions, utilizing a Binary Indexed Tree for efficient counting and simu…
物块放置查询
Determine if blocks can be placed on an infinite number line using queries, leveraging binary search over the valid answ…
数组中的峰值
Determine peaks in a dynamic integer array using efficient Binary Indexed Tree updates and range queries for fast result…
交替组 III
Solve Alternating Groups III using array manipulation and a binary indexed tree to track maximal alternating sequences e…
用点构造面积最大的矩形 I
Find the maximum area of a rectangle formed by given points on a plane with unique coordinates.
用点构造面积最大的矩形 II
Find the largest rectangle on a plane using given points while avoiding any interior points and optimizing with math and…
带权树中的最短路径
Solve the Shortest Path in a Weighted Tree using binary-tree traversal and efficient state tracking for queries.