说实话, HRT OA 难度不算“入门级”,但是整体风格还是挺清晰的,主要考察的是 逻辑推理 + 高效实现能力,题目更偏向“思维敏捷”和“代码简洁度”。我当时准备的时候发现,和一些传统大厂不同,HRT 特别喜欢那种 corner case 很多但核心思路其实不复杂 的题目。下面整理一下三道真题给大家参考。

Question 1 of 3
A positive integer is “fancy” if its representation in base 4 only includes 0s and 1s. For example:
- 17 is fancy: its base – 4 representation, 101, only includes 0s and 1s.
- 18 is not fancy: its base – 4 representation, 102, includes a 2.
Given a positive integer n, find the number of fancy positive integers less than n.
Example:
- For
n = 1, the output should be 0: there are no positive integers less than 1. - For
n = 10, the output should be 3, since {1, 4, 5} are all fancy.
Constraints:
0 < n ≤ 10⁹- [execution time limit] 0.5 seconds (cpp)
Question 2 of 3
Tiles must be identical to combine. If three tiles combine, only the two farthest in the direction of motion combine. For example, if this board moves right:2,2,2
the following board results:...,2,4
If four tiles are in a row or column, a move parallel to that row or column combines the first two and the last two (e.g. 2,2,2,2 -> 4,4). Also, the result of two tiles combining cannot collide again in the same turn.
Once the move is complete, a new value is placed at a provided X and Y coordinate. The new value must be placed after the movement for that round is complete.
You will receive a list of moves formatted as strings. Each move will be in the following format:Direction X Y Value
Example Input["U 0 0 2", "U 1 0 2", "L 3 3 4"]
Example Output"4,,,,\n,,,,\n,,,,\n,,,,4"
Constraints:
- Board is 4×4
Direction = {U, D, L, R}- Coordinates are zero-indexed
- [execution time limit] 0.5 seconds (cpp)
Question 3 of 3
You are given a grid with n rows and m columns, initially empty. A sequence of operations will be performed on this grid:
"Row r v"→ add valuevto all cells in rowr"Col c v"→ add valuevto all cells in columnc
After processing all operations, you need to return the maximum value present in the grid.
Example Input
n = 3, m = 3
operations = ["Row 1 3", "Col 0 2", "Row 2 1"]
Example Output
5
Constraints:
1 ≤ n, m ≤ 10⁵1 ≤ number of operations ≤ 10⁵- Values can be up to 10⁹
- [execution time limit] 0.5 seconds (cpp)
总结
HRT 的 OA 题整体有两个特点:
- 复杂度要求比较苛刻,几乎每道题都需要在 O(log n) 或 O(n) 级别搞定,暴力解法直接超时。
- 模拟+细节处理很考验心态,比如第二题那种 tile merge,逻辑没写全就容易挂 case。
如果准备 HRT 的同学,建议多刷一些 构造类、数位 DP、模拟大模拟 的题,心态放稳,写干净代码就行。
👉 最后,如果你觉得类似 OA/VO 压力大,或者在 coding 过程中经常卡住,Programhelp 可以提供远程语音提醒、实时OA助攻,让你保持思路清晰,不会卡在 tricky 的细节上。有学员就是靠着这种小助攻顺利通过 HRT OA,后面还拿到 onsite。