To be honest, HRT OA difficulty is not "entry-level", but the overall style is still quite clear, the main investigation is logical reasoning + efficient realization ability, the title is more inclined to "agile thinking" and "code simplicity "I'm not sure if I'm going to be able to do that. When I was preparing, I found that, unlike some traditional big companies, HRT especially likes the kind of corner case a lot but the core idea is actually not complicated. Here are three real questions for your reference.
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 representations, 101, only includes 0s and 1s.
- 18 is not fancy: its base - 4 representations, 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
If three tiles combine, only the two farthest in the direction of motion combine. For example, if this board moves right For example, if this board moves right2,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., a move parallel to that row or column combines the first two and the last two). 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 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 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)
Summarize
There are two characteristics of HRT's OA questions as a whole:
- Complexity requirements are more demanding, almost every problem needs to be solved at the O(log n) or O(n) level, and the brute force solution times out directly.
- Simulation + detailing is a test of the mindThe first question is about tile merge, for example, and it's easy to hang up a case if you don't write all the logic.
If you are preparing for HRT, we suggest you brush up on some constructor class, number DP, and simulation questions, and keep your mind at ease and write clean code.
👉 Finally, if you feel stressed by something like OA/VO, or get stuck in the coding process a lot.Programhelp You can provide remote voice reminders and real-time OA assists to keep your thoughts clear and not get stuck on tricky details. Some trainees have passed HRT OA smoothly by relying on this kind of small assistance, and even got onsite later.